Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16148

Expansions for array assignment not documented

From "E. Choroba" <choroba@matfyz.cz>
Newsgroups gnu.bash.bug
Subject Expansions for array assignment not documented
Date 2020-04-17 11:48 +0200
Message-ID <mailman.495.1587128427.3066.bug-bash@gnu.org> (permalink)
References <alpine.LSU.2.21.2004171140040.4631@triangle>

Show all headers | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.4 -L/home/abuild/rpmbuild/BUILD/bash-4.4/../readline-7.0
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g  -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g -Wuninitialized -Wextra -Wno-switch-enum -Wno-unused-variable -Wno-unused-parameter -Wno-parentheses -ftree-loop-linear -pipe -DBNC382214=0 -DIMPORT_FUNCTIONS_DEF=0 -fprofile-use -fprofile-correction
uname output: Linux triangle 4.12.14-lp151.28.44-default #1 SMP Fri Mar 20 18:20:20 UTC 2020 (dbf1aea) x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu

Bash Version: 4.4
Patch Level: 23
Release Status: release

Description:
     Expansions in an assignment are documented under "SIMPLE COMMAND EXPANSION":

     > The text after the = in each variable assignment undergoes tilde
     > expansion, parameter expansion, command substitution, arithmetic
     > expansion, and quote removal before being assigned to the
     > variable.

     However, a compound assignment to an array is different: the
     values also undergo pathname and brace expansions:

         files=(*)
         numbers=({1..10})

     Originally discovered by Roland at
     https://stackoverflow.com/q/61267714/1030675.


Repeat-By:
     I've searched the whole "man bash" for "array" and haven't found
     this documented. It's possible I've missed the documentation.

Fix:
     The additional expansions should be documented either in the
     paragraph quoted above, or in the "ARRAYS" section where compound
     assignment is described.

Cheers,

Ch.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Expansions for array assignment not documented "E. Choroba" <choroba@matfyz.cz> - 2020-04-17 11:48 +0200

csiph-web