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