I have several associative arrays,
typeset -A first
typeset -A second
# …
and want to add an element (e.g. [a]=b) to one of them, but cannot find the right syntax. Started at
if something; then
arr=first
else
arr=second
fi
$arr[a]+=b # bad
$arr+=([a]=b) # bad
and have tried many mixes of quotation marks, braces, various subscripts and parameter expansion flags, arr=$first/arr=$second, etc. Everything I've tried is an error. Can it be done?