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: Andreas Schwab
Subject: Re: How to create bash-pattern to exclude a matching param in param expansion&matching?
Date: Wed, 30 Oct 2013 12:58:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Greg Wooledge <wooledg@eeg.ccf.org> writes:

> On Wed, Oct 30, 2013 at 08:01:02AM +0000, Peggy Russell wrote:
>> A variation:
>>  
>> shopt -s nullglob
>> for f in ${1:-.}/*; do
>>   if [[ "${f}" != *-IGN-* ]];
>>     then printf -- '%s\n' "${f}"
>>   fi
>> done
>
> You missed one set of quotes:
>
>   for f in "${1:-.}"/*; do

That still won't handle whitespace in file names.  Probably better to
use find instead.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



reply via email to

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