Is there a way to check dictionary is declared in the shell?
There is a way to check variable is not empty, and there is a way to check that dictionary has a key, but not sure what is the proper way of checking that dictionary exists.
I guess I've found the solution
declare -A dictionary
dictionary[key]="val"
if [[ -z $(declare -p dictionary 2> /dev/null) ]]
then
echo no
else
echo yes
fi
But maybe there is a more idiomatic one?