Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: local variable assignment and pipelines?
- X-seq: zsh-workers 18876
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: local variable assignment and pipelines?
- Date: Mon, 21 Jul 2003 10:59:42 +0100
- In-reply-to: "Dan Nelson"'s message of "Fri, 18 Jul 2003 16:58:01 CDT." <20030718215801.GB37697@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Dan Nelson wrote:
> a=1 | echo $a -> prints "1" on zsh, prints nothing on ash,pdksh,bash
It's an inevitable but unintended side effect of the way some
substitutions are done by the shell before it forks. The list given in
subst.c is this one.
/* Do substitutions before fork. These are:
* - Process substitution: <(...), >(...), =(...)
* - Parameter substitution
* - Command substitution
* Followed by
* - Quote removal
* - Brace expansion
* - Tilde and equals substitution
*/
My guess is this is left undefined by POSIX etc. The stuff on pipelines
is fairly terse, but there might be something elsewhere since I didn't
look all that closely.
Where you would not want this to happen, and it doesn't, is if the
assignment immediately precedes a command.
pws
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author