Hi all,
not sure if this intended or not, but in bash 5.2-p15 one of our scripts
is broken. it is related to test -v, that checks, if a variable is set
together with arrays.
I condensed it to following example:
#!/bin/bash
declare -A foo
foo=(["a"]="b" ["c"]="d")
declare -a bar
bar=("a" "b" "c")
declare -a baz
baz=("foo" "bar")
for i in "${baz[@]}" ; do
echo $i
if [ ! -v "$i"[@] ] ; then
echo "$i not set"
fi
done
--------
with bash 5.2-p15 the output of this script is
foo
foo not set
bar
so, it doesn't work with associative arrays.
Instead, with 5.1-p16 the output is
foo
bar
so, in 5.1-p16 test -v with associative array works, but not with 5.2-p15.
I don't know, if this an intended change, so please can you take a look?
If it is intended, can you please explain, why this was changed, and if
there is an alternative for associative arrays?
BR, Christian
--
---------------------------------------------------------------------
RADIODATA GmbH
Newtonstr. 18
12489 Berlin
Germany
Homepage: www.radiodata.biz
USt_IdNr.: DE 195663499
WEEE-Reg.-Nr.: DE 63967380
Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg HRB Nr.: 67865
Geschäftsführer: Hans-Joachim Langermann, Malte Langermann