help-bash
[Top][All Lists]
Advanced

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

Re: How to test if a variable exists and is a hash?


From: Lawrence Velázquez
Subject: Re: How to test if a variable exists and is a hash?
Date: Sat, 11 Jul 2020 18:49:13 -0400

> On Jul 11, 2020, at 6:33 PM, Peng Yu <pengyu.ut@gmail.com> wrote:
> 
> On 7/11/20, Koichi Murase <myoga.murase@gmail.com> wrote:
>> 2020-07-12 0:43 Peng Yu <pengyu.ut@gmail.com>:
>>> What is the best way to check if a variable exists and is a hash? Thanks.
>> 
>> Why don't you use '${x@a}'?
>> 
>> $ declare -A x=()
>> $ [[ ${x@a} == *A* ]]
> 
> I am not familar with the usage of ${x@a}. Where is it documented? Thanks.

In both the man page and the manual.

https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

vq


reply via email to

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