Hey. On 5.2.15 I've noticed the following:
$ set -u $ [ -n "${array[key]+is_set}" ] && echo is set || echo not set bash: key: unbound variable $ [[ -v array[key] ]] && echo is set || echo not set bash: key: unbound variable $ declare -A array $ [ -n "${array[key]+is_set}" ] && echo is set || echo not set not set $ [[ -v array[key] ]] && echo is set || echo not set not set Once array is declared (not even anything of it set yet) it gives already no unbound error. So shouldn't the error message refer to "array" as the unbound variable? Or perhaps both "array[key]"? Because the problem isn't that no key named "key" exists. And beyond that: POSIX says: > -u > When the shell tries to expand an unset parameter other than the > '@' and '*' special parameters, it shall write a message to > standard error and the expansion shall fail with the consequences > specified in Consequences of Shell Errors. But just declaring the var, doesn't make it set... so shouldn't it still give an error message (which it does when using a non-array variable that is declared but not set)? Cheers, Chris.