diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2013-09-04 20:16:58 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2013-09-04 20:16:58 +0100 |
commit | 2afa556d8fd6b365e518ef754fc34f0ffb6854ff (patch) | |
tree | 9740722740f2b7ed5d9f0f43b39d97a5bde3c93b /Src | |
parent | 1c9931cc7d37cac9aebb034444fb87e0901e914a (diff) | |
download | zsh-2afa556d8fd6b365e518ef754fc34f0ffb6854ff.tar.gz zsh-2afa556d8fd6b365e518ef754fc34f0ffb6854ff.tar.xz zsh-2afa556d8fd6b365e518ef754fc34f0ffb6854ff.zip |
31696: In "test" No One Can Hear If You Shriek.
Treat ! as a string in "test ! -a ..." and "test ! -o ...".
Diffstat (limited to 'Src')
-rw-r--r-- | Src/parse.c | 14 |
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; |