title: Writing a for loop in bash using a variable
body: <p>I want to create a for loop in bash that runs from 1 to a number stored in a variable in <code>bash</code>. I have tried doing what the answer to <a href="https://stackoverflow.com/questions/9778741/writing-a-bash-for-loop-with-a-variable-top-end">this</a> question tells, but it produces this error:</p>
  
  <pre><code>Syntax error: Bad for loop variable
  </code></pre>
  
  <p>My OS is Ubuntu 12.04 and the code looks like this:</p>
  
  <pre><code>#!/bin/bash
  TOP=10
  for ((i=1; i&lt;=$TOP; i++))
  do
      echo $i
  done
  </code></pre>
  
  <p>What does this error message mean? Here is an output image:</p>
  
  <p><img src="https://i.stack.imgur.com/JE4DC.png" alt="enter image description here"></p>