David Kempe wrote:
John Clarke wrote:

On Mon, Feb 16, 2004 at 10:13:28 +1100, David Kempe wrote:


#if (( "ERRORNUM" >= 1 )) if [ "$ERRORNUM" != 0 ]



!= is a string operator. You want to do a numeric comparison:



Yes I realise I want to do a numeric comparision - only problem is it doesn't work:


ERRORNUM=`grepstuff $LOGTMP |totalerrors`
echo $STATUS
echo $ERRORNUM
#if (( ERRORNUM -ge 1 ))
if [ "$ERRORNUM" -ge 1 ]
        #then let STATUS="$STATUS but with errors"
        then STATUS="$STATUS but with errors"
        else echo status screwed
fi


Have you tried
if [ $ERRORNUM -ge 1 ]

Note the $ and the lack of quotes. This works for me in a backup script I have...(maybe I should check it first)

Fil
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to