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

Reply via email to