I have an array like:
moduleList=(AB, ABCdef, ABCd)
My array is numerically-indexed array not an associative array. I want to do an exact match for each element in array and to perform certain tasks.
Currently I'm doing like:
if [[ ${moduleList["AB"]} ]]; then
#do this.
fi
if [[ ${moduleList["ABCdef"]} ]]; then
#do that.
fi
But both the conditions are getting true as "AB"
is there in each word. How can I distinguish each condition based on an exact match.
x=y; y=1; echo $((x))
(or evenx=y; y=x; echo $((x))
, which does give an error).x='q[$(cat /etc/passwd >/dev/tty)]'; AB=x; echo "$AB ${moduleList["AB"]}"