tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /bin/sh: built-in "test" command and -eq, -ne etc.



> On Sun, Aug 31, 2008 at 12:21 PM, Aleksey Cheusov <cheusov%tut.by@localhost> 
> wrote:
 >> If nobody is against it I'll send a PR.
> The idea sounds not bad. However I've question how is standard describe this?
http://www.opengroup.org/onlinepubs/009695399/utilities/test.html

    The test utility shall evaluate the expression and indicate the
    result of the evaluation by its exit status. An exit status of
    zero indicates that the expression evaluated as true and an exit
    status of 1 indicates that the expression evaluated as false.

Thus, an exit status 2 is definitely a long standing "extension".

    n1 -eq  n2
    True if the integers n1 and n2 are algebraically equal; otherwise, false.

    n1 -ne  n2
    True if the integers n1 and n2 are not algebraically equal;
    otherwise, false.

    n1 -gt  n2
    True if the integer n1 is algebraically greater than the integer n2;
    otherwise, false.

    n1 -ge  n2
    True if the integer n1 is algebraically greater than or equal to the
    integer n2; otherwise, false.

    n1 -lt  n2
    True if the integer n1 is algebraically less than the integer n2;
    otherwise, false.

    n1 -le  n2
    True if the integer n1 is algebraically less than or equal to the
    integer n2; otherwise, false.

Warning messages are too because there is nothing about arguments
that are not numeric.

I didn't read entire document, though.

P.S.
NetBSD's /bin/test should also be changed accordingly.

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index