On 08/24/2010 11:32 AM, Paul Eggert wrote:
  [snip]
> Again, once things get this complicated, it doesn't cost any more
> processes to use a temporary directory, with something like this:
> 
>   dir=$(mktemp -d dir.XXXXXX)
>   mkfifo $dir/1 $dir/2
>   listener1 < $dir/1
>   listener2 < $dir/2
>   cmd1 2> $dir/1 | cmd2 2> $dir/2
> 
> This example can also be simplified and made more robust by using
> pipes instead of named fifos, as follows:
> 
>   (echo quit 1 | cmd1 3<&0 <&4) 4<&0 |
>   (:           | cmd2 3<&0 <&4) 4<&0

That simplification loses functionality because it "binds" the cmdin
channels to a specific process or pipeline.  I gave the example
"echo quit > $fifo_cmdin1" only to emphasize that the command-
and-control inputs are separate from the "main" dataflow which goes
through the regular pipes.  When I want to control a pipeline or
nest of processes interactively, then I don't know in advance
which process, which commands, or in which sequence to give them.
Using fifos allows for arbitrary flexibility of "fanout multiplexing"
my interactive commands.  I choose which fifo for each command,
at the time that the I give the command.  That cannot be done
with fixed anonymous pipes.

-- 



Reply via email to