Do homem bash:
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
Você pode usar uma correspondência de padrão mais poderosa quando isso estiver ativado.
Para ativá-lo:
~$ shopt -s extglob
Em seguida, você pode listar os arquivos que terminam com .sas
e não começam com qc_d
:
~$ ls
a.sas a.txt b.sas b.txt c.sas c.txt qc_dc.sas qc_df.sas qc_dl.sas qc_dt.sas
~$ ls !(qc_d*).sas
a.sas b.sas c.sas
Para desativá-lo:
~$ shopt -u extglob