0

I am trying to do run below command in my UNIX console:

for i in {1..5}; do echo $i; done

However, the result I am getting is below

{1..5}

Could someone suggest what's wrong with this?

Bhabani Shankar
  • 1,267
  • 4
  • 22
  • 41
  • 2
    Make sure you are using bash not `dash` or `sh` – anubhava Jan 03 '20 at 09:51
  • 1
    When I run `for i in seq 1 5; do echo $i; done` it worked fine for me(in BASH), how about if you use `for i in $(seq 1 5); do echo $i; done`? – RavinderSingh13 Jan 03 '20 at 09:52
  • What is the output of echo $SHELL? Brace expansion is a shell dependent feature and it is present in `ksh`, `bash`, and `zsh` (from the top of my head) but not on `csh`, nor on `tcsh`, for example. The most probable cause of that not being expanded is lack of support on your default shell. – accdias Jan 03 '20 at 10:02

0 Answers0