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

[BUG] Redirect between two parameter assignments causes misbehaviour

One more before i forget. Someone found this on IRC today and it puzzled us.

The following command produces no output (and returns with 0):

  % a=b 2> /dev/null c=d env

Doesn't matter what the command at the end is, could be a built-in too.

The documentation seems to suggest that it's valid for redirects to be
interspersed amongst the assignments *as well as* the command arguments, so i
think that should work? If not, the documentation needs clarified.

This is generally what happens to the variables afterwards:

  % a=b 2> /dev/null c=d env; print -r -- ${a:--} ${c:--}
  b -

Though it seems that certain interactions with other code can be quite serious.
If i run this without -f, something in my profile causes this series of commands
to hard-lock zsh with 100% CPU. Entering the first command and then the second
one separately avoids this lock-up. Unfortunately `set -x` didn't reveal
anything and i don't have any more time to look at it today, but i thought i'd
mention it.


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