Hello!

I have a question about the following behavior:

$ Z='a b'
$ A=(X=$Z)
$ declare -p A
declare -a A=([0]="X=a b")
$ A=(X$Z)
$ declare -p A
declare -a A=([0]="Xa" [1]="b")

I find it surprising that no word splitting is performed in the first compound assignment. I realize that skipping word splitting may be desirable if a subscript is given (e.g. "A=([0]=$Z)") to make it consistent with normal variable assignment[1], but in this case it looks like a bug.

I've reproduced the described behavior on bash 4.4.20 (Ubuntu 18.04), 3.1.17 (CentOS 5) and self-built 5.1-alpha release.

Some other discoveries:
* Brace expansion is performed for "A=(X=a{x,y}b)" by all bash versions mentioned above (which is inconsistent with normal variable assignment). * Globbing for "A=(X=a?b)" is performed by bash 3.1.17, but not by other versions.

[1] https://lists.gnu.org/archive/html/bug-bash/2012-08/msg00055.html

Alexey

Reply via email to