Solaris Advanced User's Guide

Single or Double Quotes on Command Lines

As shown earlier, you use quotation marks to surround text that you want to be interpreted as one word. For example, type the following to use grep to search all files for the phrase “dang it, boys”:

$ grep "dang it, boys" *

You can also use single quotation marks (') to group multiword phrases into single units. Single quotation marks also make sure that certain that the system interprets metacharacters, such as $, literally.

Note –

The history metacharacter ! is always interpreted as a metacharacter, even inside quotation marks, unless you escape it with a backslash.

Escape characters such as & ! $ ? . ; and \ when you want grep to interpret these characters as ordinary typographical characters.

For example, if you type the following command, the system displays all the lines in the file list.

$ grep $ list

However, if you type the following command, the system displays only those lines that contain the “$” character.

$ grep '\$' list

For more information on the grep(1) command, refer to the man Pages(1): User Commands.