SyntaxFix
Write A Post
Hire A Developer
Questions
You can access the keys with ${!array[@]}:
${!array[@]}
bash-4.0$ echo "${!array[@]}" foo bar
Then, iterating over the key/value pairs is easy:
for i in "${!array[@]}" do echo "key :" $i echo "value:" ${array[$i]} done