I am trying to iterate over the Bash Associate Array but it was printing only Key value pair which is wrong. How can I iterate and print correct key-value pairs.
#!/bin/bash
declare -a array=([foo]=bar [baz]=quux [corge]=gult )
for i in "${!array[@]}"
do
echo "key :" $i
echo "value:" ${array[$i]}
done
Output: key : 0 value: gult