February 2004
Beginner
200 pages
5h 40m
English
Normally, the shell treats whitespace simply as separating the words on the command line. If you want a word to contain whitespace (e.g., a filename with a space in it), surround it with single or double quotes to make the shell treat it as a unit. Single quotes treat their contents literally, while double quotes let shell constructs be evaluated, such as variables:
$ echo 'The variable HOME has value $HOME' The variable HOME has value $HOME $ echo "The variable HOME has value $HOME" The variable HOME has value /home/smith
Backquotes cause their contents to be evaluated as a command; the contents are then replaced by the standard output of the command:
$ /usr/bin/whoami smith $ echo My name is `/usr/bin/whoami` My name is smith