On Tue, Apr 06, 2021 at 06:34:21PM +0300, Ilkka Virta wrote:
> $ declare -A a=([foo]=123 [bar]=456)
> $ unset 'a[@]'
> $ declare -p a
> bash: declare: a: not found
> 
>  i.e. both remove the whole array, not just the contents.

Huh, so it does.  I didn't know that.

In that case, I have no qualms about proposing that unset 'a[@]' and
unset 'a[*]' be changed to remove only the array element whose key is
'@' or '*', respectively, and screw backward compatibility.  The current
behavior is pointless and is nothing but a surprise landmine.  Anyone
relying on the current behavior will just have to change their script.

Reply via email to