[97806] in RedHat Linux List
Re: '/usr/bin/['
daemon@ATHENA.MIT.EDU (Tomas Buday)
Thu Nov 5 06:52:19 1998
Date: Thu, 5 Nov 1998 12:52:04 +0100 (CET)
From: Tomas Buday <tomas@snt.sk>
To: "redhat-list@redhat.com" <redhat-list@redhat.com>
In-Reply-To: <363E73DC.BB88CC87@loudoun.com>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
...more on /usr/bin/[
it's a symlink pointing at /usr/bin/test...right!
suppose the followong example:
"test 1 -eq 5" ... this works fine (try echo $?)
so "[ 1 -eq 5" should work as well, but it doesn't.
...it requires a closing "]"
why is this? it's done that way, so the syntax in
the shell scripts is like this:
"if [ 1 -eg 5 ]" ...
looks better than "if [ 1 -eq 5" ... which won't work
("if test 1 -eq 5" will)
how is this done?
the only way if to do this, is make part of the code
of the /usr/bin/test command check whether arg[0] equals "test"
or "[" ....if it's "test" it does not require the last arg to
be "]"...if it isn't....the last arg needs to be "]"
> All right...
>
> Could someone please 'splain to me what the program '/usr/bin/[' is?
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com http://archive.redhat.com
To unsubscribe: mail redhat-list-request@redhat.com with
"unsubscribe" as the Subject.