How about:

TOTAL=0
:
:
                if [ "$TEST" -gt "2" ]
                then
                        TOTAL=$(($TOTAL + 1))
                fi
        done
        if [ "$TOTAL" -gt "4" ]
        then
                do stuff here...
        fi


Is that more what you were after?

Matthew

George Vieira wrote:
> 
> Hi all,
> 
> I have a loop which I need to test something in each loop and if the test
> pasts increment the counter. When the loops end and the counter = the number
> of loops, I know it passed on every loop..
> 
> What's the easiest method as I have the below script which works but the
> $TOTAL is messy...
> 
> for COUNT in 1 2 3 4 5
>         do
>                 sleep 1
>                 TMP=`ps -ef | grep $PROC | grep -v grep`
>                 TEST="`echo $TMP | cut -f 4 -d \" \"`"
>                 if [ "$TEST" -gt "2" ]
>                 then
>                         TOTAL=$TOTAL"X"
>                 fi
>         done
>         if [ "$TOTAL" -gt "XXXX" ]   <------------- now messy is that and it
> don't work!!! I get errors...
>         then blah blah blah..............
> 
> Is there a way? I've never needed it 'til now..
> thanks,
> George Vieira
> Network Administrator
> Citadel Computer Systems P/L
> http://www.citadelcomputer.com.au
> 
> --
> SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
> To unsubscribe send email to [EMAIL PROTECTED] with
> unsubscribe in the text
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text

Reply via email to