Ubuntu – Bash for loop with range {#..#}

bashcommand line

The {#..#} generate a sequence of numbers or chars, similarly to range() in Python.
If I execute the command echo {1..5} in the command line I have:

1 2 3 4 5

Instead the following bash script doesn't work as expected.

for i in {1..3};
do
    echo "Iteration $i"
done

will print:

Iteration {1..3}

Why?
*I could use seq but I read it's outdate (http://www.cyberciti.biz/faq/bash-for-loop/)

Best Answer

I've tried your code (copy paste into a terminal) and it produced a different result from what you posted:

for i in {1..3};
do
    echo "Iteration $i"
done
#---OUTPUT BELOW---
Iteration 1
Iteration 2
Iteration 3

Im using Linux Mint 12 Lisa (derived from Ubuntu) with bash version 4.2.10(1)-release