#38 Patter exclusion does not work

open
nobody
None
5
2013-01-25
2007-10-04
Martin Krischik
No

Hello,

It seems that pattern exclusion does not work when the pattern is at the end.

In my case I tried to get a list of all files in a directory except those ending on ".zwc". To create the popper patter I tried:

--------------------------------------------------
setopt EXTENDED_GLOB
setopt KSH_GLOB

ls *(^(zwc))(.)
ls *!(zwc)(.)
--------------------------------------------------

Both of which won't work as expected. From the documentation:

--------------------------------------------------
!(...)
Match anything but the expression in parentheses. (Like `(^(...))'.)
--------------------------------------------------

The way the documentation is written I expect that opposite behaviour of:

--------------------------------------------------
ls *zwc(.)
--------------------------------------------------

Which will list all files ending with zwc. And the experted opposite behaviour would be: list all file not ending of zwc.

Martin

Discussion