Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11196
| From | Charles Daffern <seejay.11@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Is this right? test -v $hash{defined_value} == false? |
| Date | 2015-07-13 07:04 +0100 |
| Message-ID | <mailman.6830.1436767471.904.bug-bash@gnu.org> (permalink) |
| References | <55A33770.8080208@tlinx.org> |
[Multipart message — attachments visible in raw view] - view raw
On 13/07/15 04:58, Linda Walsh wrote:
>> [[ -v hash[defined_value] ]] || echo fail
> fail
This one worked for me, both bare and in quotes.
>> echo $BASH_VERSION
> 4.2.45(1)-release
I'm on 4.3.39(1)-release
> This seems more messy and isn't -v supposed
> to help clean up such things?
>> [[ ${hash[defined_value]:-""} ]] || echo fail #it passes
>> [[ ${hash[defined_value1]:-""} ]] || echo fail
> fail
In non-bash shells I will usually use [ -n "${var+x}" ], because it
distinguishes between empty and unset variables.
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Is this right? test -v $hash{defined_value} == false? Charles Daffern <seejay.11@gmail.com> - 2015-07-13 07:04 +0100
csiph-web