0

I have a script blah.sh on my ubuntu laptop:

#!/bin/bash

for i in {0..10};
 do echo $i;
done

In the directory with blah.sh I call it with:

sh blah.sh

Which outputs a single line:

{0..10}

Expected ten lines:

1
2
3
4
5
6
7
8
9
10

How can I get my bash script to output as expected?

Doug Fir
  • 19,971
  • 47
  • 169
  • 299
  • 2
    You are executing the script with `sh` which does not support brace expansion. Run `bash blah.sh` instead. – tshiono Jan 19 '21 at 23:22
  • `sh` ([Bourne-shell](https://en.wikipedia.org/wiki/Bourne_shell)) is usally not `bash` ([Bourne-again shell](https://en.wikipedia.org/wiki/Bash_(Unix_shell))). – Cyrus Jan 19 '21 at 23:30

0 Answers0