|
From: | Chris F.A. Johnson |
Subject: | Re: How to create bash-pattern to exclude a matching param in param expansion&matching? |
Date: | Mon, 28 Oct 2013 18:47:29 -0400 (EDT) |
User-agent: | Alpine 2.00 (LMD 1167 2008-08-23) |
On Mon, 28 Oct 2013, Linda Walsh wrote:
I am missing how to create a bash-pattern that excludes a specific pattern. I.e. to ignore any file with '-IGN-' somewhere in the filename. The best I've come up with so far has been to use shell to build a pattern, but I know it is limited in functionality. I.e.: ls !($(echo *+(-IGN-)*|tr " " "|")) I tried the above in a dir that has 2 files w/the pattern, and 532 w/o, and it worked, but how much of that was 'luck'? Is there a better bash-pattern that doesn't use tr and such?
ls !(*-IGN-*) -- Chris F.A. Johnson, <http://cfajohnson.com/>
[Prev in Thread] | Current Thread | [Next in Thread] |