[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6900: mktemp: want option to make a fifo

From: John Reiser
Subject: bug#6900: mktemp: want option to make a fifo
Date: Tue, 24 Aug 2010 11:03:17 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4

On 08/23/2010 04:49 PM, Paul Eggert wrote:
> Here's a quick sketch
> of a shell script that solves the stated problem without using a
> named fifo.

> maybe_b2() { read line && sed 's/^./D/'; }

> a | (b1 | maybe_b2) 3>&1 | c

Thank you for reminding me about using "3>&1" for "fan-in" multiplexing.
This can work for B2, B3, ..., B8 but cannot handle more because shell
is allowed to balk at redirecting fd greater than 9.  It can be limited
further if any of the Bi already use other low file descriptors.  I also
prefer to think about the situation as "B1 is doing fan-out multiplexing"
rather than "C is doing fan-in multiplexing", because the "C" end is
more "constant" and the "B" end is more "variable".

I dislike the part "(b1 | maybe_b2)" because in practice it tends to be
fragile.  When things go wrong it is hard to diagnose and recover.
Also, I do not see how to extend it for the case of more than one
conditional process whose startup should be delayed (B3, B4, ...),
such as the 'sed' in "read line && sed ...".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]