Previous Section  < Day Day Up >  Next Section

7.4. Shell Metacharacters (Wildcards)

Like grep, sed, and awk, the shell has metacharacters. At first glance, they may look the same, but they don't always represent the same characters when the shell evaluates them. Metacharacters, as we discussed in "Metacharacters" on page 83 of Chapter 4, are special char acters used to represent something other than themselves. Shell metacharacters are often called wildcards. Table 7.1 lists the Bourne shell metacharacters and what they do.

Table 7.1. Bourne Shell Metacharacters

Metacharacter

Meaning

\

Literally interprets the following character

&

Processes in the background

;

Separates commands

$

Substitutes variables

?

Matches for a single character

[abc]

Matches for one character from a set of characters

[!abc]

Matches for one character not from the set of characters

*

Matches for zero or more characters

(cmds)

Executes commands in a subshell

{cmds}

Executes commands in current shell


    Previous Section  < Day Day Up >  Next Section