title: Bash iterate through multiple arrays
body: <p>I have defined multiple arrays:</p>
  
  <pre><code>array1=(el1 el2 el3 el4 el5)
  array2=(el10 el12 el14)
  array3=(el5 el4 el11 el8)
  </code></pre>
  
  <p>I need to iterate through all elements of all arrays. The following is the syntax I use:</p>
  
  <pre><code>for j in {1..3}
  do
      for (( k = 0 ; k &lt; ${#array$j[*]} ; k++ ))
      do
          #perform actions on array elements, refer to array elements as "${array$j[$k]}"
      done
  done
  </code></pre>
  
  <p>However, the above snippet fails with the message(s)</p>
  
  <pre><code>k &lt; ${#array$j[*]} : bad substitution and 
  ${array$j[$k]}: bad substitution
  </code></pre>
  
  <p>What is wrong with my array syntax?</p>