Consider an associative array in bash (versions 5.2.15(1)-release and 5.2.21(1)-release):
declare -A ufs=(); ufs["one"]=1; ufs["two"]=2; ufs["three"]=3
printf '> %s\n' "${!ufs[@]}"
> two
> three
> one
unset ufs["one"]
printf '> %s\n' "${!ufs[@]}"
> two
> three
All is as you'd expect.
Now let's try again, this time with nullglob enabled:
shopt -s nullglob
declare -A ufs=(); ufs["one"]=1; ufs["two"]=2; ufs["three"]=3
printf '> %s\n' "${!ufs[@]}"
> two
> three
> one
unset ufs["one"]
printf '> %s\n' "${!ufs[@]}"
> two
> three
> one
Why does the unset fail to delete the element in this case?
ufs[one]being globbed into nothing? Have you tried quoting it"ufs[one]"?declare,typesetand co., and not tosetandunsetunset name[subscript]destroys the array element at indexsubscript", I wasn't expecting theunsetto take a value that could be globbed.unsetbecause of nullglob