#!/bin/bash # Index based array -- both "hello" and "bar" evaluate to 0: indarr["hello"]="world!" indarr["bar"]="baz" echo "Contents of indarr:" for k in "${!indarr[@]}" do echo "<$k>: <${indarr[$k]}>" done # String-associative array: declare -A strarr strarr["hello"]="world!" strarr["bar"]="baz" echo "Contents of strarr:" for k in "${!strarr[@]}" do echo "<$k>: <${strarr[$k]}>" done