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


Groups > gnu.bash.bug > #14353 > unrolled thread

temp env allows variables that look like array subscripts

Started byGrisha Levit <grishalevit@gmail.com>
First post2018-07-17 16:51 -0400
Last post2018-07-17 16:51 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  temp env allows variables that look like array subscripts Grisha Levit <grishalevit@gmail.com> - 2018-07-17 16:51 -0400

#14353 — temp env allows variables that look like array subscripts

FromGrisha Levit <grishalevit@gmail.com>
Date2018-07-17 16:51 -0400
Subjecttemp env allows variables that look like array subscripts
Message-ID<mailman.3733.1531860696.1292.bug-bash@gnu.org>
Usually, an assignment preceding a command that would create a
variable with an invalid name is rejected and treated like a command
name:

$ 1=X :
bash: 1=X: command not found

But when the variable name looks (sort of) like an array subscript
assignment, it is accepted and an oddly named variable is created:

$ f() { declare -p ${!var*}; }; var[0]=X var[@]=Y f
declare -x var[0]="X"
declare -x var[@]="Y"

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web