Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2001 14:52:16 -0400 (EDT)
From:      Joe Clarke <marcus@marcuscom.com>
To:        Graham White <graham@bravenet.com>
Cc:        FreeBSD-questions <FreeBSD-questions@FreeBSD.ORG>
Subject:   Re: Newbie Bash-question
Message-ID:  <20010713145201.P25152-100000@shumai.marcuscom.com>
In-Reply-To: <20010713144955.P25152-100000@shumai.marcuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Of course, that should read -gt and not -qt.

Joe Clarke

On Fri, 13 Jul 2001, Joe Clarke wrote:

> [ expects an integer for both arg 1 and arg 2.  .30 is not an integer.
>
> if [ $LOAD -qt 1 ]; then
>
> should work for you.  IF you need more granularity, you can use Perl.
>
> Joe Clarke
>
> On Fri, 13 Jul 2001, Graham White wrote:
>
> > I'm very new to scripting so bear with me. I'm trying to generate an e-mail
> > when a load
> > average on a server exceeds a certain point.  I can extract out the
> > appropriate field with the command sequence below. I am however getting an
> > integer expected error for the $LOAD
> > variable.  I guess its pulling out the field as a string. Is there any way
> > to convert it to an integer? Also is there an issue with the numbers being
> > decimal? I hope this makes sense, thanks.
> >
> >
> >
> > LOAD=`uptime | sed -e "s/.*load average: \(.*\...\), .*\..., .*\.../\1/" -e
> > "s/ //g"| cut -d"," -f5`
> >
> > if [ $LOAD -gt .30 ] #integer expected here.
> >
> >
> > To Unsubscribe: send mail to majordomo@FreeBSD.org
> > with "unsubscribe freebsd-questions" in the body of the message
> >
> >
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010713145201.P25152-100000>