Using a variable in brace expansion range fed to a for loop

You should use a C-style for loop to accomplish this:

for ((i=1; i<=$1; i++)); do
   echo $i
done

This avoids external commands and nasty eval statements.

Leave a Comment