title: How to increment an associative array in Bash
body: <p>I have this associative array:</p>
  
  <pre><code>lettres['A']=0
  …(from 'A' to 'Z')…
  lettres['Z']=0
  </code></pre>
  
  <p>My question is simple: How to take the value of one element and increment it? I have tried the following:</p>
  
  <pre><code>lettres[$char]=${lettres[$char]}++
  </code></pre>
  
  <p>But it fails, as the result is «0++++++++». How can I easily increment the value?</p>
  
  <p>EDIT: More code:</p>
  
  <pre><code>while (( i++ &lt; ${#word} )); do
      #$char current char
      char=$(expr substr "$word" $i 1)
      if [[ "${mot[@]}" =~ "${char} " || "${mot[${#mot[@]}-1]}" == "${char}" ]]; then
          #char is currently in array $mot -&gt; skipping
          echo 'SKIPPING'
      else
          #Char is not in array $mot -&gt; adding + incrementing lettres
          ((lettres[char]++))
          echo ${lettres[$char]}
          #Adding to $mot
          mot[${#mot[@]}]=$char
      fi
      echo "&lt;$char&gt;"
  done
  </code></pre>