The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 11:00 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 09:52 PM
Avoid "++ requires lvalue" Error in Loop Calculation sandeepb Shell Programming and Scripting 3 09-24-2007 04:02 AM
How to combine "find" command in for each loop (tcsh) umen Shell Programming and Scripting 3 08-22-2005 01:07 AM
preventing "break" in a script MizzGail Shell Programming and Scripting 6 04-08-2004 10:48 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-18-2008
Registered User
 

Join Date: Nov 2006
Posts: 23
Stumble this Post!
"Break" from a Loop

I created a script-

PHP Code:
while [ ${Check} = "N" ]
do
echo 
"try this"
           
for file in `cat file_list`
           do
           echo 
$file
                     
if [ ${NewCheck} = "N" ]
                     
then 
                     sVar
="F"
                     
else
                     [
b]break[/b]
                     
fi
           done
sleep 300
done

EOF 
exit 0

Here we have "while" loop then a "for" loop and finally an "if" conditional. Now when the "if" condition fails then I use "break".

My qusn is will this BREAK , break it out of "For" Loop or totally out of "While" loop i.e. exit it out of script.

Expert opinion needed. Dont have enough time to test the it myself.

Thanks
Sumeet
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-18-2008
Registered User
 

Join Date: Jul 2006
Posts: 189
Stumble this Post!
Code:
This break is going to take you out from for loop
Reply With Quote
  #3 (permalink)  
Old 05-18-2008
Registered User
 

Join Date: Nov 2006
Posts: 23
Stumble this Post!
kool ...thats what I want ..

Thanks
Sumeet
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0