June 2017
Beginner
502 pages
11h 26m
English
Double quotes are the so-called weak quoting, since they prevent the interpretation by the shell of all metacharacters except for $, ", ', and \. This means a few things; the most important is that you can reference a variable value even if it is quoted:
zarrelli:~$ x=10 ; echo "$x"10
This also means that you can use backslash to escape $ to print the literal $a string:
zarrelli:~$ x=10 ; echo "\$x"$x
So, to use one of the preceding interpreted characters, you have to escape it with a backslash.
Also, double quotes preserve whitespaces, so we can rewrite the command we saw earlier:
mkdir this\ is\ a\ directory\ with\ spaces\ in\ the\ name as mkdir "this is a directory with spaces in the name".
So, what if you want to prevent ...
Read now
Unlock full access