title: foreach loop through associative array in bash only returns last element
body: <p>This should print the whole associative array to the console:</p>
  
  <pre><code>#!/bin/sh
  
  declare -a array=([key1]='value1' [key2]='value2')
  
  for key in ${!array[@]}; do
      echo "Key = $key"
      echo "Value = ${array[$key]}"
  done
  
  echo ${array[key1]}
  echo ${array[key2]}
  </code></pre>
  
  <p>Instead it prints oly the last variable:</p>
  
  <pre><code>[mles@sagnix etl-i_test]$ ./test.sh 
  Key = 0
  Value = value2
  value2
  value2
  </code></pre>
  
  <p>Where is my fault?</p>
  
  <p><strong>@htor</strong>:
  Bash Version is 3.2.25(1)-release.</p>