ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Why do we echo "source /opt/ros/kinetic/setup/bash"?

asked 2016-12-27 13:03:05 -0600

sharan100 gravatar image

This guide here specifies the command $ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc to source the setup.bash in the ~/.bashrc. For this reason, the end of my .bashrc has been looking like the code snippet below.

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc

source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash
source /opt/ros/kinetic/setup.bash

Why can't we just add a source /opt/ros/kinetic/setup.bash to the .bashrc instead of the echo?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-12-27 13:25:14 -0600

billtecteacher gravatar image

This command is done one time only:

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc

Once it is appended to .bashrc everytime you open a new terminal the bash script /opt/ros/indigo/setup.bash is run.

You could edit .bashrc in a number of ways to add the line "source /opt/ros/indigo/setup.bash" to the end of the .bashrc file, echo is just a handy way to edit .bashrc.

edit flag offensive delete link more

Comments

"could" -> "should".

gvdhoorn gravatar image gvdhoorn  ( 2016-12-27 13:38:10 -0600 )edit

So a simple source /opt/ros/kinetic/setup.bash would suffice? I was wondering if there was a particular reason as to why the echo was being used.

sharan100 gravatar image sharan100  ( 2016-12-27 13:55:12 -0600 )edit
gvdhoorn gravatar image gvdhoorn  ( 2016-12-27 14:04:12 -0600 )edit
3

I think you misread the installation / setup instructions, as they don't actually tell you to add the echo "source .. line to your .bashrc.

gvdhoorn gravatar image gvdhoorn  ( 2016-12-27 14:05:38 -0600 )edit

yeah, I would think so!

sharan100 gravatar image sharan100  ( 2016-12-28 03:41:02 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-27 13:03:05 -0600

Seen: 8,911 times

Last updated: Dec 27 '16