1.18 Who Handles Wildcards?Wildcards (1.16 ) are actually defined by the UNIX shells, rather than the UNIX filesystem. In theory, a new shell could define new wildcards, and consequently, we should discuss wildcarding when we discuss the shell. In practice, all UNIX shells (including ksh , bash , and other variants (1.8 ) ) honor the same wildcard conventions, and we don't expect to see anyone change the rules. (But different shells do different things when a wildcard doesn't match (15.4 ) .) You may see different wildcarding if you buy a special-purpose shell that emulates another operating system (for example, a shell that looks like DEC's DCL)-in this case, your shell will obey the other operating system's wildcard rules. But even in this case, operating system designers stick to a reasonably similar set of wildcard rules. The fact that the shell defines wildcards, rather than the filesystem itself or the program you're running, has some important implications for a few commands. Most of the time, a program never sees wildcards. For example, typing: % is exactly the same as typing: % In this case everything works as expected.
But there are other situations in which
wildcards don't work at all.
Assume you want to read some files from a tape, which requires
the command
tar x
(20.4
)
,
so you type the command
You'll be disappointed - unless older versions of the files you want
are already in your
current directory (1.21
)
.
The shell expands the wildcard
There's a way to pass wildcards to programs, without having them interpreted
by the shell.
Simply put
Some versions of tar understand wildcards, but many don't. There is a clever workaround (20.9 ) . - |
|