[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this right? test -v $hash{defined_value} == false?
From: |
Chet Ramey |
Subject: |
Re: Is this right? test -v $hash{defined_value} == false? |
Date: |
Mon, 13 Jul 2015 09:03:43 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
On 7/12/15 11:58 PM, Linda Walsh wrote:
>> set -A hash
This is an error.
>> hash=([defined_value]=22)
This creates an indexed array.
>> echo ${hash[defined_value]}
> 22
>> [[ -v ${hash[defined_value]} ]] && echo pass
test/[/[[ -v didn't understand array variables and subscripts until bash-4.3.
>> echo $BASH_VERSION
> 4.2.45(1)-release
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/