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

From: Paul Eggert <[email-masked]>
Date: Mon, 23 Aug 2010 16:49:59 -0700

On 08/23/2010 03:55 PM, Eric Blake wrote:
> We may be able to help you efficiently re-write your existing code into
> an equally manageable but more portable solution using existing tools,
> or it may help to convince us that the shorthand is truly useful.

I agree that a full example would be helpful.  Here's a quick sketch
of a shell script that solves the stated problem without using a
named fifo.  Without the full example it's hard to say whether
this approach would work well in the existing code.

#! /bin/sh
nl='
'
a() { for i in 0 1 2 3 4 5; do echo B$i; echo C$i; done; }
b1() {
   start_b2=$nl
   while read command
   do
     case $command in
     (C*) printf '%s\n' "$command" >&3;;
     (B*) printf '%s\n' "$start_b2$command"; start_b2=;;
     esac
   done
}
maybe_b2() { read line && sed 's/^./D/'; }
c() { sed 's/^/E/'; }

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