title: Copy a bash associative array using eval statement
body: <p>Before we get into the question, I know there are answers SIMILAR to this on stack overflow already. However this one is unique in it's use of the eval statement with associative arrays. ( Believe me I've read them all ).</p>
  <p>Okay now into the question</p>
  <p>I have X number of arrays defined via an eval function similar to this:</p>
  <pre><code>for (( i=1;i&lt;=X;i++ ))
  do
     eval &quot;declare -gA old$i&quot;
     eval &quot;old$i[key]=value&quot;
  done
  </code></pre>
  <p>This code is in function : makeArrays</p>
  <p>Now I have a second function that must loop through these different arrays</p>
  <pre><code>old1
  old2
  .
  .
  .
  oldX
  </code></pre>
  <p>I'll call this function : useArrays</p>
  <p>Now, I have a for loop for this useArrays function.</p>
  <pre><code>for (( i=0;i&lt;$#;i++ ))
  do
    // ACCESS OLD1[KEY]
  done
  </code></pre>
  <p>My question is, how do I access this array FOR COMPARISONS.
  I.E.
  if[ old1 -eq 0 ]
  then
  ...
  fi</p>
  <p>Is there a way I could COPY these associate arrays into a variable I can use for comparisons using eval as little as possible?</p>