Unix shell script for loop

I am not getting the output like
1
2
3
4
5



START=1
END=5
for i in {1..5}
do
   echo "$i"
done

----
digs developerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nemws1Database AdministratorCommented:
Which shell are you using?  Bash?  If so, what version?

If bash, do this to get the version:

echo $BASH_VERSION
0
digs developerAuthor Commented:
version
4.1.2(1)-release
0
digs developerAuthor Commented:
When I used below then correct output is showing.

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


But my requirement is passing runtime value depending upon count.
value 5 = runtime count from file
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

digs developerAuthor Commented:
START=1
 END=5
 for i in {$start..$END}
 do
    echo "$i"
 done
0
sventhanCommented:
it just works fine for me ..
[oracle@bosdwtst scripts]$ echo $BASH_VERSION
4.1.2(1)-release
[oracle@bosdwtst scripts]$ ./cs.sh
1
2
3
4
5
[oracle@bosdwtst scripts]$ cat cs.sh
for i in {1..5}
do
echo "$i"
done
[oracle@bosdwtst scripts]$
0
digs developerAuthor Commented:
Please use below code

START=1
  END=5
  for i in {$start..$END}
  do
     echo "$i"
  done
0
nemws1Database AdministratorCommented:
Can you just use 'seq' instead?
#!/bin/bash
START=1
END=5
for i in $(seq $START $END)
do
    echo "$i"
done

Open in new window

0
nemws1Database AdministratorCommented:
This will also work:
#!/bin/bash
START=1
END=5
for i in $(eval echo "{$START..$END}")
do
    echo "$i"
done

Open in new window

0
digs developerAuthor Commented:
Thank you so much !!
0
woolmilkporcCommented:
Another option:

START=1
END=5

for (( i=$START; i<=$END; i++))
 do
   echo $i
 done
0
gheistCommented:
$ seq 1 5
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.