Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Glob'ing for a pattern that DOESN'T match...



On Mar 16,  4:11pm, Eddy J. Gurney wrote:
} Subject: Glob'ing for a pattern that DOESN'T match...
}
} One of the biggest problems is that ZSHEXPN man page says that:
} 
}     ^x   matches anything except the pattern x.
} 
} Any ideas on what I might be doing wrong?

Have you tried `setopt extendedglob` ?

} I'm trying to write a `compctl' for `rm' so that `rm' will never complete
} on various source files (.c, .h, .cc, .c++, etc.) and am having no luck
} in getting it to work.

This should get you started:

setopt extendedglob
compctl -g '^*.(c|h|cc|c++)' rm

You might think that ^*.{c,h,cc,c++} should work, but brace expansion is
not part of globbing (something I find extremely counter-intuitive); so
that's actually shorthand for the four patterns ^*.c ^*.h ^*.cc ^*.c++,
each of which includes everything excluded by the others (and you end up
right back where you started).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author