Skip to content

Bash:PatternMatching

Bash의 Glob 패턴 매칭 (Pattern Matching)

Hot to use

상당히 잘 알려진 단순한 와일드 카드 문자 외에도 bash는 추가 기능을 추가하는 확장 된 Globbing을 한다. 이러한 확장 기능은 extglob 옵션을 통해 활성화된다.

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