On Fri, Apr 17, 2015 at 11:12:50AM +0200, isabella parakiss wrote: > I need to check if an element in an associative array is set. What's the > correct way to test it?
dualbus@yaqui ~ % export key; for key in \* x y; do bash -c 'declare -A
a=([x]=y [y]=); echo "$key" ${a[$key]+inarray}; declare -p a'; done
*
declare -A a='([x]="y" [y]="" )'
x inarray
declare -A a='([x]="y" [y]="" )'
y inarray
declare -A a='([x]="y" [y]="" )'
--
Eduardo Bustamante
https://dualbus.me/
