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


Groups > gnu.bash.bug > #14353

temp env allows variables that look like array subscripts

From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject temp env allows variables that look like array subscripts
Date 2018-07-17 16:51 -0400
Message-ID <mailman.3733.1531860696.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


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"

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


Thread

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

csiph-web