我在bash中有以下哈希图代码-
{
"priceAfterTax": 150.00,
"priceBeforeTax": 130.43,
"tax": 15.00,
"taxAmount": 19.57
}
此处的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
打印值-$PUB_DOMAIN
,而不是键。
这是怎么了?