March 2002
Beginner
504 pages
10h 47m
English
In many cases, you will need to quote some meta-characters but allow others to be evaluated by the shell. For example, the following echo command contains some meta- characters that must be quoted and others that should not:
$ echo '$USER owes <-$1250.**>; [ as of (`date +%m/%d`) ]'
Because the string is single quoted, the output is easy to predict—what you see is what you get:
$USER owes <-$1250.**>; [ as of (`date +%m/%d`) ]
As you can imagine, this is not exactly what you wanted; the single quotes have prevented variable substitution and command substitution from occurring, thus the variable $USER, which contains the username of the current user, was not replaced with the appropriate value and the date command was not ...
Read now
Unlock full access