bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing the way bash expands associative array subscripts


From: Ilkka Virta
Subject: Re: Changing the way bash expands associative array subscripts
Date: Tue, 6 Apr 2021 18:34:21 +0300

On Tue, Apr 6, 2021 at 6:13 PM Greg Wooledge <greg@wooledge.org> wrote:

> As a counter-proposal, Chet could entirely remove the special meaning
> of unset 'a[@]' and introduce a new option to unset which would take
> its place.  It appears -a is not yet used, so that would be a good pick.
>

Unless I missed something, doesn't just  unset a  do the same:

$ declare -A a=([foo]=123 [bar]=456)
$ unset a
$ declare -p a
bash: declare: a: not found

$ 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]