You are previewing The Linux Command Line.

The Linux Command Line

Cover of The Linux Command Line by William E. Shotts Jr. Published by No Starch Press
O'Reilly logo


Now that we’ve seen how many ways the shell can perform expansions, it’s time to learn how we can control it. For example, take this:

[me@linuxbox ˜]$ echo this is a     test
this is a test

Or this:

[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 provides a mechanism called quoting to selectively suppress unwanted expansions.

Double Quotes

The first type of quoting we will look at is double quotes. If you place text inside double quotes, all the special characters used by the shell ...

The best content for your career. Discover unlimited learning on demand for around $1/day.