分类: LINUX
2015-02-09 14:01:30
If you need to suppress all expansions, you use single quotes. Here is a comparison of unquoted, double quotes, and single quotes:
[me@linuxbox me]$ echo text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER
text /home/me/ls-output.txt a b foo 4 me
[me@linuxbox me]$ echo "text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER"
text ~/*.txt {a,b} foo 4 me
[me@linuxbox me]$ echo 'text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER'
text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER
As you can see, with each succeeding level of quoting, more and more of the expansions are suppressed.