Skip to content
Search

Bash:PatternMatching

lastmod 2020-10-06created 2020-10-062 edits

Glob pattern matching (Pattern Matching) in Bash

Hot to use

In addition to the fairly well-known simple wildcard characters, bash supports extended globbing, which adds extra features. These extended features are enabled through the extglob option.

List of Pattern Matching

Pattern

Description

*

Match zero or more characters

?

Match any single character

[...]

Match any of the characters in a set

?(patterns)

Match zero or one occurrences of the patterns (extglob)

*(patterns)

Match zero or more occurrences of the patterns (extglob)

+(patterns)

Match one or more occurrences of the patterns (extglob)

@(patterns)

Match one occurrence of the patterns (extglob)

!(patterns)

Match anything that doesn't match one of the patterns (extglob)

See also

Favorite site

author Zer0 sitemap