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 imagegvdhoorn ( 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 imagesharan100 ( 2016-12-27 13:55:12 -0600 )edit
gvdhoorn gravatar imagegvdhoorn ( 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 imagegvdhoorn ( 2016-12-27 14:05:38 -0600 )edit

yeah, I would think so!

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 3,514 times

Last updated: Dec 27 '16