[TUHS] Pipes (was Re: After 50 years, what has the Impact of Unix been?)
Warner Losh
imp at bsdimp.com
Fri Dec 6 08:03:18 AEST 2024
On Thu, Dec 5, 2024 at 2:13 PM Dan Cross <crossd at gmail.com> wrote:
> On Thu, Dec 5, 2024 at 3:56 PM <arnold at skeeve.com> wrote:
> > Chet Ramey via TUHS <tuhs at tuhs.org> wrote:
> > > On 12/5/24 10:19 AM, Dan Cross wrote:
> > >
> > > > Unix pipelines, on the other hand, tend to be used in a manner that
> is
> > > > strictly linear, without the fan-out and fan-in capabilities
> described
> > > > by Morrison. Of course, nothing prevents one from building a
> > > > Morrison-style "network" from Unix processes and pipes, though it's
> > > > hard to see how that would work without something like `select`,
> which
> > > > didn't yet exist in 1978. Regardless, Unix still doesn't expose a
> > > > particularly convenient syntax for expressing these sorts of
> > > > constructions at the shell.
> > >
> > > Process substitution is about as close as we can get, but most programs
> > > still process their filename arguments one at a time, beginning to end.
> > >
> > > The canonical process substitution example is
> > >
> > > diff <(old-program-version) <(new-program-version)
> > >
> > > to do simple regression testing.
> >
> > And fanout is simply
> >
> > ... | tee >(pipeline1) >(pipeline2)
>
> And indeed these things are pretty nifty, but don't they generate
> trees, and not arbitrary dags? They don't quite capture the full
> generality of Morrison-style networks since it doesn't seem like
> there's a way to connect process substitution fan-out with fan-in; at
> least, not conveniently.
>
> It is, perhaps, notable that Go allows me to do this sort of thing
> with channels and goroutines, but it has `select` built into the
> language.
>
> Funny, despite using Unix almost daily for over 30 years now, I don't
> think I've ever felt limited by the power of pipelines. On the
> contrary, I've lost count of the times I've felt limited on systems
> that do Not support pipes.
>
The <() , >() syntax is a bash extension. Not all shells support it. And
I couldn't find them in POSIX Issue 8.
Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20241205/fc82b860/attachment.htm>
More information about the TUHS
mailing list