[NTLUG:Discuss] for loop - bash scripting..

Richard Geoffrion ntlug at rain4us.net
Wed Dec 7 09:39:38 CST 2005


Fred James wrote:

>Richard Geoffrion wrote:
>
>  
>
>>how do you end an $INSTANCE in a for/loop without killing the entire 
>>loop?
>>
>>
>>    
>>
>
>Richard Geoffrion
>I believe the simplest general form would be
>
>for i in list
>do
>    if test whatever
>    then
>       do this
>    else
>       continue
>    fi
>    other_stuff
>done
>
>  
>
Yes.. continue was it!  I don't want to break out of the FOR loop 
itself..just end that particular instance ($i).   I tried 'break', Eric, 
but if I used that then the $list never got processed..and the script 
would jump down PAST the 'done'.

All is working well.  A few tweaks..and some logic changes and I am up 
and running.  Thanks guys.  It's so nice that I'm not beating my head on 
the wall with this issue anymore.

-- 
Richard





More information about the Discuss mailing list