bug-bash
[Top][All Lists]
Advanced

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

Re: test '-v' - associative vs. normal array discrepancy - a bug ?


From: Piotr Grzybowski
Subject: Re: test '-v' - associative vs. normal array discrepancy - a bug ?
Date: Wed, 19 Nov 2014 19:34:31 +0100

Hi,

 it is here:

test.c:

642    t = assoc_reference (assoc_cell (v), "0");

 mostly what Greg said.
 do you think we should return true there for non-empty associative arrays?

cheers,
pg



On Wed, Nov 19, 2014 at 5:20 PM, Jason Vas Dias
<jason.vas.dias@gmail.com> wrote:
> Good day -
> Please could anyone explain why the first command below produces no output:
> $ ( declare -A a=([a]=1);   if [ -v a ]; then echo yes; fi )
> $ ( declare -a  a=([0]=1);  if [ -v a ]; then echo yes; fi )
> yes
> $
> There does not appear to be any documentation about
> different behaviour of -v for associative vs. normal arrays:
>
>        -v varname
>               True if the shell variable varname is set (has been
> assigned a value).
>
> Should that be ammended to :
>         -v varname
>               True if the shell variable varname is not an associative
> array and is set
>               (has been assigned a value).
> or is this a bug with -v ?
>
> I'm using bash-4.3.30(1) , but it appears also to be an issue  with
> bash-4.3.11(1) .
>
> Regards,
> Jason
>



reply via email to

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