?(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 one of the given patterns |
!(pattern-list) |
Matches anything except one of the given patterns |
The patters can be any of the regular patterns so
+([:digit:]) matches one or more digits.
Configuring Pattern Matching: There are shell options that allow control over how the shell matches patterns and how it reacts to failed patterns.
dotglob |
If set, bash includes filenames beginning with a ‘.’ in the results of pathname expansion. |
extglob |
If set, the extended pattern matching features described above under Pathname Expansion are enabled. |
failglob |
f set, patterns which fail to match filenames during pathname expansion result in an expansion error. |
globstar |
If set, the pattern ** used in a filename expansion context will match a files and zero or more directories and subdirectories. If the pattern is followed by a /, only directories and subdirectories match. |