how do I correctly negate multiple zsh globbing expressions?
I have a directory with files. All the files have extensions. The extensions fall into one of 3 types: txt
, foo
and bar
.
I want to print all files that do not end in foo
neither bar
.
I already know how to list all files that does not end in foo
:
set extended_glob
print ^*.foo
but how to combine that negation to also exclude *.bar
?
something like
print ^(*.foo & *.bar)
does not work. Man page did not help with this.
how to achieve the desired behaviour?
Solution 1:
found the answer:
print ^*.(foo|bar)