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

Re: PATCH: perform expansion for precommand modifiers



On Wed, 26 Apr 2017 14:25:08 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> This also fixes this bug reported recently, to wit, quoting a precommand
> modifier to protect it from alias expansion did not work correctly:
> 
> torch% alias exec='echo foo'
> torch% ( exec -c printenv )
> foo -c printenv
> torch% ( \exec -c printenv )
> zsh: command not found: -c
> 
> Now:
> 
> torch% alias exec='echo foo'
> torch% ( exec -c printenv )
> foo -c printenv
> torch% ( \exec -c printenv )
> torch% ( \exec printenv ) 
> MANPATH=... and so on

Here's a test.

diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 32caf5f..37311ce 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -114,6 +114,12 @@
 0:`exec' with -c option
 >xx
 
+  (\exec /bin/sh -c 'echo Test one'; print Not reached)
+  ('exec' /bin/sh -c 'echo Test two'; print Not reached)
+0:exec with quotes
+>Test one
+>Test two
+
   cat() { echo Function cat executed; }
   command cat && unfunction cat
 0:`command' precommand modifier



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