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: Bryan Roessler
Subject: Re: -v no longer works for associative arrays
Date: Thu, 13 Oct 2022 12:47:08 -0400

For indexed arrays, yes. I hadn't made the connection with associative
arrays since I don't typically index them with numbers, thanks.

$ declare -A f[0]=true
$ declare -A g[foo]=bar
$ test -v f; echo $?
0
$ test -v g; echo $?
1

On Thu, Oct 13, 2022 at 12:10 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 10/13/22 12:06 PM, Oğuz wrote:
>
> >   test -v seems broken anyway
> >
> > $ declare -A foo=(a 42)
> > $ declare -a bar=(42)
> > $ test -v foo; echo $?
> > 1
> > $ test -v bar; echo $?
> > 0
>
> You know that referencing an array variable without a subscript is
> equivalent to referencing element 0 (or "0").
>
> --
> ``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]