Package Management and Software Repositories
Debian based Linux distributions rely on repositories (databases of application installation packages and upgrade packages) to keep the operating systems updated and also to easily fetch and install new software packages. The location of these repositories are stored in
/etc/apt/sources.list, however additional sources, usually unique to specific applications can be stored in the
When the package index update command
apt-get update is executed, your operating system checks with these package repositories for available packages and registers the available softwares as available to your operating system which you can go on to install using the traditional
apt-get install <package> command.
An example of one of these software sources is:
deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty main restricted
It is important for these sources to reference specific versions of linux distributions. An example is trusty which is the codename for Ubuntu 14.04. You can query your OS (debian based) for complete details with
lsb_release -a or
lsb_release -sc which means short and codename.
In your question, the part
$(lsb_release -sc) is interpreted and the result from your operating system is printed into the custom source file ros-latest.list which the command will create upon execution.
Command language interpreter
sh command is the bourne shell. This is one, among several shells but is considered the old standard and generally one you can be certain exist. It's also common to see
bash in many shell scripts. That declaration is specifying the shell to use as different shells use different syntax.
As regards the
-c flag, quoting
If the -c option is present, then commands are read from
string. If there are arguments after the string, they are
assigned to the positional parameters, starting with $0.
Everything within the
'' is read as a string, you wouldn't need to figure out how to escape various quotation marks or worry about the shell interpreting something the wrong way.
The command prints
deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main to a custom source file, replacing
$(lsb_release -sc) with the interpreted value.