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


Groups > gnu.bash.bug > #14355

test -v and environment variable names with subscripts

From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject test -v and environment variable names with subscripts
Date 2018-07-17 17:19 -0400
Message-ID <mailman.3735.1531862377.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


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

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


Thread

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

csiph-web