title: Writing a bash for-loop with a variable top-end
body: <p>I frequently write for-loops in bash with the well-known syntax:</p>
  
  <pre><code>for i in {1..10}  [...]
  </code></pre>
  
  <p>Now, I'm trying to write one where the top is defined by a variable:</p>
  
  <pre><code>TOP=10
  for i in {1..$TOP} [...]
  </code></pre>
  
  <p>I've tried a variety of parens, curly-brackets, evaluations, etc, and typically get back an error "bad substitution".</p>
  
  <p>How can I write my for-loop so that the limit depends on a variable instead of a hard-coded value?</p>