OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

Quoting

Now that we've seen how many ways the shell can perform expansions, it's time to learn how we can control it. Take for example:


[me@linuxbox ~]$ echo this is a

this is a test

test

[me@linuxbox ~]$ echo this is a

this is a test


image

or:



[me@linuxbox ~]$ echo The total is $100.00

The total is 00.00

[me@linuxbox ~]$ echo The total is $100.00

The total is 00.00


In the first example, word-splitting by the shell removed extra whitespace from the echo command's list of arguments. In the second example, parameter expansion substituted an empty string for the value of “$1” because it was an undefined variable. The shell pro- vides a mechanism called quoting to selectively suppress unwanted expansions.


 

Top OS Cloud Computing at OnWorks: