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. A backslash escapes the following character; the escaping backslash is discarded when matching. The special pattern characters must be quoted if they are to be matched literally.
The special pattern characters have the following meanings:
globstarshell option is enabled, and ‘*’ is used in a filename expansion context, two adjacent ‘*’s used as a single pattern will match all files and zero or more directories and subdirectories. If followed by a ‘/’, two adjacent ‘*’s will match only directories and subdirectories.
For example, in the default C locale, ‘[a-dx-z]’ is equivalent to ‘[abcdxyz]’. Many locales sort characters in dictionary order, and in these locales ‘[a-dx-z]’ is typically not equivalent to ‘[abcdxyz]’; it might be equivalent to ‘[aBbCcDdxXyYz]’, for example. To obtain the traditional interpretation of ranges in bracket expressions, you can force the use of the C locale by setting the LC_COLLATE or LC_ALL environment variable to the value ‘C’.
Within ‘[’ and ‘]’, character classes can be specified
using the syntax
:], where class is one of the
following classes defined in the posix standard:
alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit
A character class matches any character belonging to that class.
word character class matches letters, digits, and the character
Within ‘[’ and ‘]’, an equivalence class can be
specified using the syntax
matches all characters with the same collation weight (as defined
by the current locale) as the character c.
Within ‘[’ and ‘]’, the syntax
matches the collating symbol symbol.
extglob shell option is enabled using the
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