On Wed, Jan 12, 2000 at 03:05:57AM +1100, Shrestha wrote:
> In shell programming in linux, if I want to do something if the number is 3 then I
>can write
>
> if [$numb ="3"]
> then
> echo "hello"
> fi
>
> But if I have to write a condition "greater that 3 and less than 10", how do I write
>it?
You want "man 1 test", which will tell you about:
if [ \( $numb -gt 3 \) -a \( $numb -lt 10 \) ]; then
echo "hello"
fi
That's because /bin/[ is a link to /bin/test, and not part of the
"if" statement. "if" just evaluates it's argument, and does the
"then" part if the result is true (0). In this case, the argument
is "[ $numb -eq 3 ]", which is equivelant to "test $numb -eq 3".
--
Andrew
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text