On Wed, Feb 7, 2024 at 2:24 AM Grisha Levit <grishale...@gmail.com> wrote:

> Maybe it would be appropriate to reject a request to turn off an
> attribute that is being turned on?
>

Since this seems specific to indexed and associative arrays, it might make
more sense to just give the same error you get if you try to unset the
attribute later.

$ unset assoc array
$ assoc='spoon'
$ declare -A assoc
$ declare -p assoc
declare -A assoc=([0]="spoon" )
$ declare +A assoc
-bash: declare: assoc: cannot destroy array variables in this way
$ array='fork'
$ declare -a array
$ declare -p array
declare -a array=([0]="fork")
$ declare +a array
-bash: declare: array: cannot destroy array variables in this way

Reply via email to