Any character that appears in a pattern, other than the special pattern characters described below, matches itself. The NUL character may not occur in a pattern. The special pattern characters must be quoted if they are to be matched literally.
The special pattern characters have the following meanings:
*
|
Matches any string, including the null string. |
?
|
Matches any single character. |
[...]
|
Matches any one of the enclosed characters. A pair of characters
separated by a minus sign denotes a range;
any character lexically between those two characters, inclusive,
is matched. If the first character following the
`[ ' is a `! ' or a `^ '
then any character not enclosed is matched. A ` '
may be matched by including it as the first or last character
in the set. A `] ' may be matched by including it as the first
character in the set.
Within `
A character class matches any character belonging to that class.
Within `
Within ` |
If the extglob
shell option is enabled using the shopt
builtin, several extended pattern matching operators are recognized.
In the following description, a pattern-list is a list of one
or more patterns separated by a `|
'.
Composite patterns may be formed using one or more of the following
sub-patterns:
?(pattern-list)
|
Matches zero or one occurrence of the given patterns. |
*(pattern-list)
|
Matches zero or more occurrences of the given patterns. |
+(pattern-list)
|
Matches one or more occurrences of the given patterns. |
@(pattern-list)
|
Matches exactly one of the given patterns. |
!(pattern-list)
|
Matches anything except one of the given patterns. |