Secara sederhana, globbing mengacu pada pencocokan pola. Bash menggunakan globbing like sederhana, echo l*yang diperluas ke daftar file dalam direktori saat ini yang dimulai dengan huruf l. Tentu saja, seperti yang bisa Anda tebak, itu sederhana dan terbatas.
Masukkan extglob. Seperti yang bisa Anda tebak, itu singkatan extended globbing. Opsi ini memungkinkan pencocokan pola lebih lanjut. Dari man bash:
extglob If set, the extended pattern matching features described
above under Pathname Expansion are enabled.
Dan sedikit sebelum itu:
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 one of the given patterns
!(pattern-list)
Matches anything except one of the given patterns
Ada banyak cara yang extglobbisa digunakan. Beberapa contoh bagus disediakan dalam Linux Journal dan Greg's wiki .