pattern
to a UNIX shell, and it replaces pattern with the names
of all files that match pattern. Some simple examples of
pattern might be:
rm *
ls -l get_buf.?
Another commonly used term for this is called wildcard expansion.
zsh offers very powerful and expressive filename generation - it goes
far beyond what all other UNIX shells can do. To disable filename
generation, turn off the GLOB option. (unsetopt
GLOB)
* ( | < [ ?
If the EXTENDED_GLOB option is set, zsh will also recognize
the following:
^ #
If one or more files match the pattern, zsh replaces that word with a sorted list of the matching filenames. If no match is found, you can configure zsh's behavior:
| Zsh will: | If you: |
|---|---|
| Display an error message | do nothing (default behavior) |
| Delete the word from the command line | set the NULL_GLOB option
|
| Leave the word unchanged | set the NOMATCH option |
**/, and it will search all directories recursively. Use
***/ if you want zsh to follow symlinks.
For example, to find all .c, .h, and .o files in a directory and all of its subdirectories, enter something like:
lyric > print -l /usr/local/src/**/*.[cho] ... /usr/local/src/fvwm-2.2/modules/FvwmWinList/Mallocs.c /usr/local/src/fvwm-2.2/modules/FvwmWinList/Mallocs.h /usr/local/src/fvwm-2.2/utils/xpmroot.c /usr/local/src/mutt-0.95.4/_regex.h /usr/local/src/mutt-0.95.4/acconfig.h ...
More about wildcard patterns on the next page.
/ and .
/ must be matched explicitly.
/'s in pattern explicitly.
. must be matched explicitly at the start
of a pattern or immediately after a
/.
pattern. (Or after a
/).
. and .. will never show up in any
wildcard match.
Note that rule 2 does not apply if the option
GLOB_DOTS is set.