December 1999
Beginner
528 pages
11h 10m
English
Use the double quotes to take literally everything except the following characters: $, ` , \. That’s a dollar, back quote and backslash; these characters keep their special meanings to the shell. If we assigned a string to a variable using double quotes to echo it, we see that there is no difference when echoing the variable.
$ STRING="MAY DAY, MAY DAY, GOING DOWN"
$ echo "$STRING"
MAY DAY, MAY DAY, GOING DOWN
$ echo $STRING
MAY DAY, MAY DAY, GOING DOWN
Now suppose we want to assign the system’s date output to a variable called mydate:
$ MYDATE="date"
$ echo $MYDATE
date
Because the shell is taking everything ‘as is’ inside the string, the date has no special significance, therefore will hold just the word date.
When ...
Read now
Unlock full access