2021年3月1日(月) 18:37 felix <fe...@f-hauri.ch>:
> $ unset map["$key"]
> Linux

This is a topic that is often discussed on this mailing list, and I
think the conclusion is that we should always write it as

$ unset 'map[$key]'

In addition to the extra expansions of the array subscripts, `unset
map["$key"]' has another problem. For example, when there is a file
named `mapf', it will be expanded to `unset mapf'. When there are no
matching filenames but `shopt -s failglob/nullglob' is set, it will
also result in unexpected behavior. You can also see

https://mywiki.wooledge.org/BashPitfalls#unset_a.5B0.5D

--
Koichi

Reply via email to