bug-bash
[Top][All Lists]
Advanced

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

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


From: DJ Mills
Subject: Lack of quotes causes IFS to be ignored for "${arr[*]}" during assignments
Date: Thu, 29 Aug 2013 13:03:20 -0400

$(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.


reply via email to

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