From owner-freebsd-questions Fri Jul 13 11:50:45 2001 Delivered-To: freebsd-questions@freebsd.org Received: from shumai.marcuscom.com (rdu26-228-058.nc.rr.com [66.26.228.58]) by hub.freebsd.org (Postfix) with ESMTP id 0292737B403 for ; Fri, 13 Jul 2001 11:50:42 -0700 (PDT) (envelope-from marcus@marcuscom.com) Received: from localhost (marcus@localhost) by shumai.marcuscom.com (8.11.3/8.11.3) with ESMTP id f6DIom525350; Fri, 13 Jul 2001 14:50:48 -0400 (EDT) (envelope-from marcus@marcuscom.com) X-Authentication-Warning: shumai.marcuscom.com: marcus owned process doing -bs Date: Fri, 13 Jul 2001 14:50:48 -0400 (EDT) From: Joe Clarke To: Graham White Cc: FreeBSD-questions Subject: Re: Newbie Bash-question In-Reply-To: Message-ID: <20010713144955.P25152-100000@shumai.marcuscom.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [ 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