Re: Array parameter expansion with non-space-IFS on bash-3/4
From:
Chet Ramey
Subject:
Re: Array parameter expansion with non-space-IFS on bash-3/4
Date:
Sun, 29 Nov 2009 16:33:03 -0500
User-agent:
Thunderbird 2.0.0.23 (Macintosh/20090812)
DennisW wrote:
> On Nov 27, 3:47 pm, Freddy Vulto <fvu...@gmail.com> wrote:
>> I noticed different behaviour between bash-3 and bash-4 when
>> performing parameter expansion on an array with IFS set to a non-space
>> value. For example, on bash-3.2.39, I get:
>>
>> $ bash -c 'IFS=:; printf "<%s>\n" "${@/q}"' x a b
>> <a b>
>>
>> Whereas on bash-4.0.33, I get:
>>
>> $ bash -c 'IFS=:; printf "<%s>\n" "${@/q}"' x a b
>> <a>
>> <b>
>>
>> Bash-4 seems to give the desired result (leave the array intact), but
>> it's a bug on bash-3?
>>
>> Regards,
>>
>> Freddy Vultohttp://fvue.nl
>
> It seems to be a combination of IFS and pattern substitution.
It was a bug in bash-3.2, fixed in bash-4.0.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/