Hi Herbert, please see
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=384197

On Tue, Aug 22, 2006 at 03:29:35PM +0100, Colin Watson wrote:
>   $ [ '!' != '*' ]
>   [: 1: *: unexpected operator
>
> POSIX says of the 3-argument case for test(1):
>
>   3 arguments:
>
>     * If $2 is a binary primary, perform the binary test of $1 and $3.
>     * If $1 is '!', negate the two-argument test of $2 and $3.
>     * [XSI] If $1 is '(' and $3 is ')', perform the unary test of $2.
>     * Otherwise, produce unspecified results.
>
> It seems to me that dash performs the first two rules in the wrong
> order. (POSIX doesn't explicitly say that these rules are ordered, I
> suppose, but anything else seems to be a tortuous interpretation.)

Yes, I agree.  Treating ! the same as other BINOPs should fix this.
---
 src/bltin/test.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/bltin/test.c b/src/bltin/test.c
index f16c819..33a4acd 100644
--- a/src/bltin/test.c
+++ b/src/bltin/test.c
@@ -82,7 +82,6 @@ enum token {
 enum token_types {
        UNOP,
        BINOP,
-       BUNOP,
        BBINOP,
        PAREN
 };
@@ -125,7 +124,7 @@ static struct t_op {
        {"-nt", FILNT,  BINOP},
        {"-ot", FILOT,  BINOP},
        {"-ef", FILEQ,  BINOP},
-       {"!",   UNOT,   BUNOP},
+       {"!",   UNOT,   UNOP},
        {"-a",  BAND,   BBINOP},
        {"-o",  BOR,    BBINOP},
        {"(",   LPAREN, PAREN},
-- 
1.4.2.3


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to