[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to create bash-pattern to exclude a matching param in param expa
From: |
Eric Blake |
Subject: |
Re: How to create bash-pattern to exclude a matching param in param expansion&matching? |
Date: |
Mon, 28 Oct 2013 16:41:11 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
On 10/28/2013 04:35 PM, 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 " " "|"))
for $var in *; do
case $var in
*-IGN-*) ;;
*) # whatever you wanted on the remaining files
;;
esac
done
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature