Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14353 > unrolled thread
| Started by | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| First post | 2018-07-17 16:51 -0400 |
| Last post | 2018-07-17 16:51 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
temp env allows variables that look like array subscripts Grisha Levit <grishalevit@gmail.com> - 2018-07-17 16:51 -0400
| From | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| Date | 2018-07-17 16:51 -0400 |
| Subject | temp 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"
Back to top | Article view | gnu.bash.bug
csiph-web