In Bash 5.2, unsetting an associative array at script level makes declare -p report that it no longer exists. Inside a function, the same check prints declare -- myassoc, although the array contents are gone.
Why is the function different, and is there a way to test whether a variable is declared without confusing that with whether it has a value?
Related Discussions