Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I've got a while loop. Within the

Status
Not open for further replies.

vergeb

MIS
Sep 22, 2003
8
US
I've got a while loop. Within the while loop I use read to get imput. Then I use case to do different things based on the imput. Does anyone know the command that will make it just go back to the top of the loop? To exit the loop? Do those same commands work in an if then statement?
 
continue;

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
As Vlad states - continue will cause the next iteration of the loop to be executed ( ie go back to top)
break will cause the loop to cease execution.
exit terminates the script.
Break and continue aren't applicable to if/then
statements, unless of course, the if is in a
while/for/until do loop.
eg
while true
do
if [ $a -eq $b ]
then
break
else
do something otherwise........
fi
done

HTH

Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top