You didn't mention how you were executing your script and that can make a difference. Suppose we have a script:
$ cat welcome.sh
for i in {1..3}
do
echo "Welcome $i times"
done
echo "\n"
Observe the following three invocations of welcome.sh from a bash shell:
$ ps -p $$
PID TTY TIME CMD
11509 pts/25 00:00:00 bash
$ source welcome.sh
Welcome 1 times
Welcome 2 times
Welcome 3 times
$ bash welcome.sh
Welcome 1 times
Welcome 2 times
Welcome 3 times
$ sh welcome.sh
Welcome {1..3} times
The last one fails because, on my system, sh
defaults to dash
, not bash
. This is true, for example, for any modern Debian/Ubuntu-derived system.