bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lack of quotes causes IFS to be ignored for "${arr[*]}" during assig


From: Dan Douglas
Subject: Re: Lack of quotes causes IFS to be ignored for "${arr[*]}" during assignments
Date: Thu, 29 Aug 2013 13:38:28 -0500
User-agent: KMail/4.11 (Linux/3.10.1-pf+; KDE/4.11.0; x86_64; ; )

On Thursday, August 29, 2013 01:03:20 PM DJ Mills wrote:
> $(arr=(foo bar baz); IFS=:; str=${arr[*]}; echo "$str")
> foo bar baz
> $ (arr=(foo bar baz); IFS=:; str="${arr[*]}"; echo "$str")
> foo:bar:baz
> 
> Note that the same thing does not occur for "$*":
> $ (set -- foo bar baz; IFS=:; str=$*; echo "$str")
> foo:bar:baz
> $ (set -- foo bar baz; IFS=:; str="$*"; echo "$str")
> foo:bar:baz
> 
> I would expect the behavior of the two to be identical.
> 
> $ echo "$BASH_VERSION"
> 4.2.45(2)-release
> 
> It also occurs in 4.2.45(1)-release and 3.2.51(1)-release.

This was this issue:
http://gnu-bash.2382.n7.nabble.com/More-fun-with-IFS-td11388.html

The assignments are all consistent in 4.3.

https://gist.github.com/ormaaj/6381747
-- 
Dan Douglas



reply via email to

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