Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Pipeline question (echo hello | echo $(cat))
- X-seq: zsh-users 13727
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh users list <zsh-users@xxxxxxxxxx>
- Subject: Re: Pipeline question (echo hello | echo $(cat))
- Date: Sun, 18 Jan 2009 16:03:26 -0800
- In-reply-to: <49738E4C.8070005@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <49738E4C.8070005@xxxxxxxxxx>
On Sun, Jan 18, 2009 at 12:17 PM, Matthew Flaschen
<matthew.flaschen@xxxxxxxxxx> wrote:
>
> echo hello | echo $(cat)
>
> cat: -: Input/output error
Hmm.
I'm not sure this is precisely an order-of-execution thing; rather, I
think zsh over-optimizes the way the builtin echo is run in the
current shell scope. Consider that these variants do what you expect:
echo hello | { echo $(cat) }
echo hello | while echo $(cat); do break; done
The command in braces and the "while" are also run in the current
shell scope, but don't suffer from the i/o error. You can see this
with e.g.:
echo hello | { echo $(cat); SCOPE=current }; echo $SCOPE
Messages sorted by:
Reverse Date,
Date,
Thread,
Author