What are the different kinds of loops available in shell script?

Showing Answers 1 - 5 of 5 Answers

shiv

  • Jun 3rd, 2005
 

for, if, while, case

  Was this answer useful?  Yes

joadavis

  • Jun 3rd, 2005
 

if and case are not loops but rather control structures. 
until is also used with the while keyword 
I checked in "KornShell Programming Tutorial" by Barry Rosenberg to be sure this is right.

abhay

  • Jul 5th, 2005
 

Broadly categorised in 3 
for  
while 
until

  Was this answer useful?  Yes

kabhishek

  • Dec 11th, 2009
 

3 loops

for
while
until  --> Just reverse of while loop

-----------------------
"if-elif" or "if else" or "case" not comes in the loop

  Was this answer useful?  Yes

amverma10

  • Jan 4th, 2010
 

While loop
The syntax for while is:

while condition
do
statements...
done

For loops
The syntax for the for loop:
for name [in list]
do
statements that can use $name...
done
Untill loops
The until construct works almost exactly the same as while. The only difference is that until executes the body of the loop so long as the conditional expression is false, whereas while executes the body of the loop so long as the conditional expression is true. Think of it as saying, "Execute until this condition becomes true."

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions