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 12:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 10: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 Search this Thread Display Modes
  #1  
Old 05-18-2008
Registered User
 

Join Date: Nov 2006
Posts: 28
"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  
Old 05-18-2008
Registered User
 

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

Join Date: Nov 2006
Posts: 28
kool ...thats what I want ..

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:43 PM.


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

Content Relevant URLs by vBSEO 3.2.0