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.
signature.asc
Description: OpenPGP digital signature