title: Bash - Creating Arrays using loop counter
body: <p>I am writing a bash script where I need to create arrays inside a for loop and name each array using the string contained in the counter (an array element) each iteration.</p>
  
  <p>Here is the code: </p>
  
  <pre><code>myArray=( joe bob dave mark )
  
  
  for i in "${myArray[@]}"
  do
    "$k_array"=( `cat fileUsedToPopulate.txt` )
  done
  
  # echo to test if one of the arrays has been created and populated
  
  for j in "${joe_array[@]}"
  do
    echo $j
  done
  </code></pre>
  
  <p>The desired result is 4 arrays, joe_array bob_array etc, each populated with the file.</p>
  
  <p>However I haven't found anyway to escape the $k so that it appends to the array name when declaring/populating it. </p>
  
  <p>Here is the error I am getting: </p>
  
  <p>line 30: syntax error near unexpected token <code>`cat fileUsedToPopulate.txt</code>'
  line 30: <code>"$k_array"=(</code>cat $DIR/$braDir/oem.txt` )'</p>
  
  <p>Thanks for any help provided.</p>