Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Apr 1998 17:38:52 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Dean Hollister <dean@odyssey.apana.org.au>, FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: bash question
Message-ID:  <19980407173852.47780@freebie.lemis.com>
In-Reply-To: <Pine.BSF.3.96.980407140742.9001A-100000@odyssey.apana.org.au>; from Dean Hollister on Tue, Apr 07, 1998 at 02:09:11PM %2B0800
References:  <Pine.BSF.3.96.980407140742.9001A-100000@odyssey.apana.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue,  7 April 1998 at 14:09:11 +0800, Dean Hollister wrote:
>
> Hi,
>
> Just a quick (and no doubt easy question). I have a bash script, and want
> to check if a value is greater than 100 and less than 1000. I get as far
> as:
>
> if [ $value what goes in here? ]; then
> dosomething
> fi

if [ $value -gt 100 -a $value -lt 1000 ]; then
  dosomething
fi

It's in the man page for test(1).  The name [ is a synonym for test:

$ ls -l /bin/[ /bin/test
-r-xr-xr-x  2 bin  bin  45056 Mar 27 14:30 /bin/[
-r-xr-xr-x  2 bin  bin  45056 Mar 27 14:30 /bin/test

Greg

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?19980407173852.47780>