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


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

test -v and environment variable names with subscripts

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

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


Contents

  test -v and environment variable names with subscripts Grisha Levit <grishalevit@gmail.com> - 2018-07-17 17:19 -0400

#14355 — test -v and environment variable names with subscripts

FromGrisha Levit <grishalevit@gmail.com>
Date2018-07-17 17:19 -0400
Subjecttest -v and environment variable names with subscripts
Message-ID<mailman.3735.1531862377.1292.bug-bash@gnu.org>
When there is a variable with a name that includes a subscript in the
environment, test -v looks at that variable rather than an array with
that subscript.

I just posted about two ways [1] [2] to create variables like
`var[0]=X' and if both of those methods are fixed than this report
might be moot -- or it might still be worthwhile to guard against this
if other bugs similar to the above-referenced ones exist.

For example:

$ set -u; unset var; f() { test -v 'var[0]'; echo $?; }; var[0]=X f
0
-bash: var[0]: unbound variable

[1] https://lists.gnu.org/archive/html/bug-bash/2018-07/msg00068.html
[2] https://lists.gnu.org/archive/html/bug-bash/2018-07/msg00069.html

[toc] | [standalone]


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


csiph-web