about summary refs log tree commit diff
path: root/Src/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/parse.c')
-rw-r--r--Src/parse.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Src/parse.c b/Src/parse.c
index 0c2a45833..f0d0855d3 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2088,9 +2088,17 @@ par_cond_2(void)
 	}
     }
     if (tok == BANG) {
-	condlex();
-	ecadd(WCB_COND(COND_NOT, 0));
-	return par_cond_2();
+	/*
+	 * In "test" compatibility mode, "! -a ..." and "! -o ..."
+	 * are treated as "[string] [and] ..." and "[string] [or] ...".
+	 */
+	if (!(condlex == testlex && *testargs && 
+	      (!strcmp(*testargs, "-a") || !strcmp(*testargs, "-o"))))
+	{
+	    condlex();
+	    ecadd(WCB_COND(COND_NOT, 0));
+	    return par_cond_2();
+	}
     }
     if (tok == INPAR) {
 	int r;