declare -A animals=(["moo"]="cow" ["woof"]="dog") for sound in "${!animals[@]}"; do echo "$sound - ${animals["$sound"]}"; done
时间: 2024-11-10 17:07:40
declare -A animals=(["moo"]="cow" ["woof"]="dog") for sound in "${!animals[@]}"; do echo "$sound - ${animals["$sound"]}"; done