Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exec | wc isn't very useful...
- X-seq: zsh-users 8302
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: exec | wc isn't very useful...
- Date: Thu, 16 Dec 2004 13:50:11 +0000
- In-reply-to: <20041215225146.GA27274@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041215185920.GA24992@xxxxxxxxxxxxxxxxxxxxxxx> <200412151918.iBFJI1F5008660@xxxxxxxxxxxxxx> <20041215225146.GA27274@xxxxxxxxxxxxxxxxxxxxxxx>
Anthony Heading wrote:
> > A pipeline is fundamentally different from a redirection.
>
> I don't quite see that - aside from the very real underlying
> implementation issues, what is wrong with a conceptual model
> that views:
> a | b | c
> as pure syntactic sugar for:
> a > >(b > >(c))
> ?
Currently, the combination > >(...) is not special; >(...) produces a
file name (either a named pipe or a /dev/fd entry) and > redirects into
it. In principle that could be changed to use pipes internally.
There are still some major differences, however.
First, a > >(b) creates b as a subprocess and then runs a. This is
different from a | b as here a is created in a subprocess, then b is
run. Actually, some shells do it the other way around, but there are
some good uses for having b running in the main shell.
Second, the shell doesn't wait for the processes in the command
substitution to exit. This is different from a pipeline where the shell
waits for the all the processes before the job is finished.
A more subtle, but possibly the most critical, difference is that in
a > >(b > >(c))
the process c is forked from b, not from the parent shell. This means
that the parent shell isn't even aware of c. This makes it impossible
to treat as a pipeline where all the processes are forked from (or run
in) the parent shell.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author