Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16610
| From | Alexey Izbyshev <izbyshev@ispras.ru> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | No word splitting for assignment-like expressions in compound assignment |
| Date | 2020-07-24 03:11 +0300 |
| Message-ID | <mailman.436.1595552364.24492.bug-bash@gnu.org> (permalink) |
| References | <6614fa7668daf7f2b450e319a28b624c@ispras.ru> |
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
Back to gnu.bash.bug | Previous | Next | Find similar
No word splitting for assignment-like expressions in compound assignment Alexey Izbyshev <izbyshev@ispras.ru> - 2020-07-24 03:11 +0300
csiph-web