Cover by William E. Shotts Jr.

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Quoting

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 ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required