Another one: ` backquote char, always used in pair. Command substitution: replace with result (output) of running the command. Replace command with its output.
$ date Tue 12 Apr 12:20 1995 $ echo date date $ echo `date` Tue 12 Apr 12:21 1995 $ echo Today is `date` Today is Tue 12 Apr 12:21 1995 $ `date` is replaced by its output, attempt is made to execute Tue: command not found $ ls -l `which cat` #long listing of the cat command file, wherever it is Useful to give list of filenames to command: $ wc `locate .java | grep wills` #wc of wills' .java files $ ls -l `find . -name 'core*'` # listing of all core dump files $ file `locate .gif` | egrep -v 'GIF|symbolic' #any .gif filename that is not a GIF file nor a symbolic link Which bash builtins are also the name of commands in your PATH of directories? $ for i in `cat bash_builtins` ;do which $i 2>/dev/null ;done $ mail billybob barack hillary rudy mitt <letter1 $ cat >tolist billybob barack hillary rudy mitt $ mail `cat tolist` <letter1 $ cat alf a b c d $ echo `cat alf` # echo turns newline into space a b c dNew syntax for command substitution: $(cmd) Allows nested substitutions.
$ ps -aux | fgrep "`who | cut -f1 -d' '`" #processes of logged on users