Good day - Please could anyone explain why the first command below produces no output: $ ( declare -A a=([a]=1); if [ -v a ]; then echo yes; fi ) $ ( declare -a a=([0]=1); if [ -v a ]; then echo yes; fi ) yes $ There does not appear to be any documentation about different behaviour of -v for associative vs. normal arrays:
-v varname True if the shell variable varname is set (has been assigned a value). Should that be ammended to : -v varname True if the shell variable varname is not an associative array and is set (has been assigned a value). or is this a bug with -v ? I'm using bash-4.3.30(1) , but it appears also to be an issue with bash-4.3.11(1) . Regards, Jason