Skip to Content
Learning the bash Shell, Second Edition
book

Learning the bash Shell, Second Edition

by Cameron Newham, Bill Rosenblatt
January 1998
Beginner
336 pages
10h 6m
English
O'Reilly Media, Inc.
Content preview from Learning the bash Shell, Second Edition

Special Characters and Quoting

The characters <, >, |, and & are four examples of special characters that have particular meanings to the shell. The wildcards we saw earlier in this chapter (*, ?, and [...]) are also special characters.

Table 1.6 gives the meanings of all special characters within shell command lines only. Other characters have special meanings in specific situations, such as the regular expressions and string-handling operators that we’ll see in Chapter 3 and Chapter 4.

Table 1-6. Special Characters

Character Meaning See Chapter
~ Home directory1
` Command substitution (archaic)4
# Comment4
$ Variable expression3
& Background job1
* String wildcard1
( Start subshell8
) End subshell8
\ Quote next character1
| Pipe1
[ Start character-set wildcard1
] End character-set wildcard1
{ Start command block7
} End command block7
; Shell command separator3
' Strong quote1
<"> Weak quote1
< Input redirect1
> Output redirect1
/ Pathname directory separator1
? Single-character wildcard1
! Pipeline logical NOT5

Quoting

Sometimes you will want to use special characters literally, i.e., without their special meanings. This is called quoting. If you surround a string of characters with single quotation marks (or quotes), you strip all characters within the quotes of any special meaning they might have.

The most obvious situation where you might need to quote a string is with the echo command, which just takes its arguments and prints them to the standard output. What is the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning the bash Shell, 3rd Edition

Learning the bash Shell, 3rd Edition

Cameron Newham

Publisher Resources

ISBN: 1565923472Supplemental ContentCatalog PageErrata