OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

Single Quotes

If we need to suppress all expansions, we use single quotes. Here is a comparison of un- quoted, double quotes, and single quotes:



[me@linuxbox ~]$ echo text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER

text /home/me/ls-output.txt a b foo 4 me

[me@linuxbox ~]$ echo "text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER"

text ~/*.txt {a,b} foo 4 me

[me@linuxbox ~]$ echo 'text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER'

text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER

[me@linuxbox ~]$ echo text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER

text /home/me/ls-output.txt a b foo 4 me

[me@linuxbox ~]$ echo "text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER"

text ~/*.txt {a,b} foo 4 me

[me@linuxbox ~]$ echo 'text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER'

text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER


As we can see, with each succeeding level of quoting, more and more of the expansions are suppressed.


Top OS Cloud Computing at OnWorks: