[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test -v for array does not work as documented
From: |
Ulrich Mueller |
Subject: |
Re: test -v for array does not work as documented |
Date: |
Wed, 19 Feb 2020 17:18:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (gnu/linux) |
>>>>> On Wed, 19 Feb 2020, Chet Ramey wrote:
> On 2/19/20 7:00 AM, Ulrich Mueller wrote:
>> Bash Version: 5.0
>> Patch Level: 16
>> Release Status: release
>>
>> Description:
>> The GNU Bash Reference Manual Version 5.0 says about test -v:
>> '-v VARNAME'
>> True if the shell variable VARNAME is set (has been
>> assigned a value).
>>
>> However, it doesn't always return true when VARNAME is an
>> (indexed or associative) array that has been assigned a value.
> If you refer to an array variable without the subscript, it's equivalent
> to referencing element 0.
That doesn't seem obvious from the documentation for -v.
So, is there any syntax that allows to test if a value has been assigned
to the array variable? Especially, to distinguish VARNAME=() (empty
array) from VARNAME being unset?
- test -v for array does not work as documented, Ulrich Mueller, 2020/02/19
- Re: test -v for array does not work as documented, Chet Ramey, 2020/02/19
- Re: test -v for array does not work as documented,
Ulrich Mueller <=
- Re: test -v for array does not work as documented, Chet Ramey, 2020/02/19
- Re: test -v for array does not work as documented, pepa65, 2020/02/19
- Re: test -v for array does not work as documented, Stephane Chazelas, 2020/02/19
- Re: test -v for array does not work as documented, Ulrich Mueller, 2020/02/20
- Re: test -v for array does not work as documented, pepa65, 2020/02/20
- Re: test -v for array does not work as documented, Grisha Levit, 2020/02/19