GNU Info

Info Node: (bashref.info)Filename Expansion

(bashref.info)Filename Expansion


Next: Quote Removal Prev: Word Splitting Up: Shell Expansions
Enter node , (file) or (file)node

Filename Expansion
------------------

Pattern Matching
How the shell matches patterns.
   After word splitting, unless the `-f' option has been set (Note: The
Set Builtin), Bash scans each word for the characters `*', `?', and
`['.  If one of these characters appears, then the word is regarded as
a PATTERN, and replaced with an alphabetically sorted list of file
names matching the pattern. If no matching file names are found, and
the shell option `nullglob' is disabled, the word is left unchanged.
If the `nullglob' option is set, and no matches are found, the word is
removed.  If the shell option `nocaseglob' is enabled, the match is
performed without regard to the case of alphabetic characters.

   When a pattern is used for filename generation, the character `.' at
the start of a filename or immediately following a slash must be
matched explicitly, unless the shell option `dotglob' is set.  When
matching a file name, the slash character must always be matched
explicitly.  In other cases, the `.' character is not treated specially.

   See the description of `shopt' in Note: Bash Builtins, for a
description of the `nocaseglob', `nullglob', and `dotglob' options.

   The `GLOBIGNORE' shell variable may be used to restrict the set of
filenames matching a pattern.  If `GLOBIGNORE' is set, each matching
filename that also matches one of the patterns in `GLOBIGNORE' is
removed from the list of matches.  The filenames `.' and `..' are
always ignored, even when `GLOBIGNORE' is set.  However, setting
`GLOBIGNORE' has the effect of enabling the `dotglob' shell option, so
all other filenames beginning with a `.' will match.  To get the old
behavior of ignoring filenames beginning with a `.', make `.*' one of
the patterns in `GLOBIGNORE'.  The `dotglob' option is disabled when
`GLOBIGNORE' is unset.


automatically generated by info2www version 1.2.2.9