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

Re: exec -a and parameter expansion



On 2011-01-07 at 23:09 +0100, Christian Neukirchen wrote:
> trying to write a script that sets argv[0] for a child process, I tried
> using exec -a and noticed this difference:
> 
> % zsh -c 'exec -a $OSTYPE ps ax' |grep ax
>  3755 pts/19   RN+    0:00 ?OSTYPE ax
> 
> % bash -c 'exec -a $OSTYPE ps ax' |grep ax
>  3876 pts/19   RN+    0:00 linux-gnu ax
> 
> I expected the latter output for zsh too.  (And I can't explain the "?".)

In part it depends upon the OS, locale and what happens for unprintable
characters for you.

For me, that's hex [92  77  94  69], shown as [\   M   ^   E].

> Is this a bug?

Yes.  Looks like another one I introduced, I never tested the
interaction of "exec -a foo" with a variable as foo.

Unfortunately, my understanding of zsh's internal parse state is weak
enough that I don't know the fix.  Somewhere in the BINF_EXEC handling,
I *think* that some kind of unmeta() is needed, but my naive approaches
have not worked.

-Phil



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