title: Bash- populate an associative array using a loop
body: <p>So I have this to be entered into and associative array:</p>
  
  <pre><code>47 SPRINGGREEN2
  48 SPRINGGREEN1
  49 MEDIUMSPRINGGREEN
  50 CYAN2
  51 CYAN1
  52 DARKRED
  53 DEEPPINK4
  </code></pre>
  
  <p>It's part of a bash script. 
  I'm looking for a way to make an associative array out of this, so it would look like</p>
  
  <pre><code>    declare -A cols=( [SPRINGGREEN2]="0;47"...[DEEPPINK4]="0;53" )
  </code></pre>
  
  <p>I can do that quite easily manually.</p>
  
  <p>But I want to use a for loop to populate the array cols=( [KEY]="vALUE" )
  For loop will take 47, 48, 49...53 and out it into VALUE field, 
  and SPRINGGREEN2...DEEPPINK4 into the key field. </p>
  
  <p>I was thinking using awk but couldn't figure our how to isolate the two fields and use each entry to populate the array. </p>