title: Bash: Correct way to Iterate over Map
body: <p>In Bash I can create a <strong>map</strong> (hashtable) with this common construction</p>
  
  <pre><code>hput() {
    eval "$1""$2"='$3'
  }
  
  hget() {
    eval echo '${'"$1$2"'#hash}'
  }
  </code></pre>
  
  <p>and then use it like this:  </p>
  
  <pre><code>hput capitals France Paris
  hput capitals Spain Madrid
  echo "$(hget capitals France)"
  </code></pre>
  
  <p>But how do I best iterate over the entries in the map ?. For instance, in Java I would do: </p>
  
  <pre><code>for (Map.Entry&lt;String, String&gt; entry : capitals.entrySet()) {
    System.out.println("Country " + entry.getKey() + " capital " + entry.getValue());
  }
  </code></pre>
  
  <p>is there a common way of accomplishing something similar in Bash ?.</p>