2

I am using ROS (Robot Operating System www.ros.org). I have to source .sh file every time. What it means ?

source /opt/ros//setup.bash

or have to enter this line in .bashrc file

Why we need this ?

Volker Siegel
  • 12,820
  • 5
  • 48
  • 65
TonyParker
  • 343
  • 2
  • 4
  • 10
  • It is Robot Operating System www.ros.org – TonyParker Sep 09 '14 at 13:28
  • 1
    I fail to see how this is Ubuntu related. – guntbert Sep 09 '14 at 20:13
  • 1
    @guntbert I don't know much about ROS but I don't think it's an operating system in the sense we're used to. It seems to be software you install in an OS, to do development. [Their official wiki has a page for installing on Ubuntu.](http://wiki.ros.org/indigo/Installation/Ubuntu) I don't think it's a separate OS that the OP would be using on their computer *instead* of Ubuntu; this probably really is Ubuntu-related. – Eliah Kagan Sep 09 '14 at 22:35
  • ROS is a metaOS not an OS per se. – El Zo Feb 08 '18 at 09:49

1 Answers1

6

We can't know what it does exactly is unless you show us the contents of /opt/ros/setup.bash. In general, sourcing a script means that the script is executed but in your current shell. It is often used to set up certain variables and make them available in your current session.

For example, the script below simply defines the variable foo and gives it the value of bar:

foo=bar

If I save that as foo.sh and source it, the variable will be available to me:

## Before sourcing, $foo is empty
$ echo $foo
$ 
## Once I source, $foo is defined
$ source foo.sh
$ echo $foo
bar
$
terdon
  • 98,183
  • 15
  • 197
  • 293