bug-bash
[Top][All Lists]
Advanced

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

Re: -v no longer works for associative arrays


From: Chet Ramey
Subject: Re: -v no longer works for associative arrays
Date: Thu, 13 Oct 2022 11:41:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2

On 10/13/22 10:42 AM, Bryan Roessler wrote:

Bash Version: 5.2
Patch Level: 2
Release Status: release

Description:

bash-5.2# declare -A a
bash-5.2# a[foo]=bar
bash-5.2# [[ -v a[@] ]]; echo $?
1

From CHANGES:

j. Associative array assignment and certain instances of referencing (e.g.,
   `test -v') now allow `@' and `*' to be used as keys.

There are other ways to test whether or not an associative array has any
set elements, but there was no way to use `*' or `@' as a key in previous
versions.

There was a long discussion about this back in early 2021. Some of the
relevant messages about `@' and `*' keys start here:

https://lists.gnu.org/archive/html/bug-bash/2021-04/msg00058.html

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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