bug-bash
[Top][All Lists]
Advanced

[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: Bob Proulx
Subject: Re: How to create bash-pattern to exclude a matching param in param expansion&matching?
Date: Mon, 28 Oct 2013 17:11:32 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Eric Blake wrote:
> for $var in *; do
>   case $var in
>     *-IGN-*) ;;
>     *) # whatever you wanted on the remaining files
>       ;;
>   esac
> done

A couple of minor syntax errors in the above.  But we know it is
simply that perl influence that dragged you that way.  :-)

This is a typical pattern for me.  But I optimize it a little bit when
possible by doing it this way.

  for var in *; do
    case $var in
      *-IGN-*) continue ;;
    esac
    whatever you wanted on the remaining files
  done

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]