I have the following hashmap code in bash-
declare -A PUBS
PUBS=( "FEE":"[345, 342]" "FOO":"[1, 2, 44]" "BAR":"[23, 67]" )
for pub in "${PUBS[@]}"
do
PUB_DOMAIN="$pub"
CAT="${PUBS[$pub]}"
printf "Key is %s" "$PUB_DOMAIN"
printf "\n"
done
The $PUB_DOMAIN
here prints the values- [345, 342]
, instead of keys.
What's wrong here?