I want to create a for loop in bash that runs from 1 to a number stored in a variable in bash
. I have tried doing what the answer to this question tells, but it produces this error:
Syntax error: Bad for loop variable
My OS is Ubuntu 12.04 and the code looks like this:
#!/bin/bash
TOP=10
for ((i=1; i<=$TOP; i++))
do
echo $i
done
What does this error message mean? Here is an output image: