Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: About 'test' compatibility



On Tue, 26 Feb 2002, Bart Schaefer wrote:

> > >No, it's the -d in $DEFAULT that's confusing it.  When $DEFAULT is
> > >-d, zsh is treating the above as "if there is a directory named `='
> > >..."
>
> It appears that bash gives the infix '=' higher precedence than the prefix
> '-d' or the infix '-a'

This really is a bug in zsh.  `[ -d = -d ]' is correctly parsed as an
infix `=' comparison, but `[ -d = -d anything ... ]' is not.

Does anybody know why the parser cares about !testargs[2] in the fragment
below?  Everything seems to work fine with it commented out.

Index: parse.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/parse.c,v
retrieving revision 1.11
diff -c -r1.11 parse.c
--- parse.c	2002/01/07 15:18:23	1.11
+++ parse.c	2002/02/28 05:40:49
@@ -1859,7 +1859,7 @@
 	    condlex();
 	    return par_cond_double(dupstring("-n"), s1);
 	}
-	if (testargs[1] && !testargs[2]) {
+	if (testargs[1] /* && !testargs[2] */) {
 	    /* three arguments: if the second argument is a binary operator, *
 	     * perform that binary test on the first and the trird argument  */
 	    if (!strcmp(*testargs, "=")  ||




Messages sorted by: Reverse Date, Date, Thread, Author