title: How to construct variable name in Bash?
body: <p>I want to construct variable name <code>N_foo</code> and <code>N_bar</code> and use their values in the following:</p>
  
  <pre><code>#!/bin/bash
  N_foo=2
  N_bar=3
  for i in { "foo" "bar" }
  do
      for j in { 1..$(`N_$i`) }
      do
          echo $j
      done
  done
  </code></pre>
  
  <p>I want to use the values of <code>N_foo</code> and <code>N_bar</code> in the two inner loops and print out 1, 2 and 1, 2, 3, respectively. What's the correct syntax?</p>