[H-GEN] Piping

Andrae Muys A.Muys at mailbox.uq.edu.au
Mon Nov 3 08:56:48 EST 1997


On Mon, 3 Nov 1997, Anthony Towns wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> _Why_ does it wait until I hit ^D when I chain more than just one
> command into my pipe? (or, at least, why does it wait until it's
> buffer is full, rather than doing it simulatenously)
> 
Well you just answered what it's doing. :)

OK, here's my understanding of what's happening.  First, other then the
buffering handled by libc, cat and grep don't buffer their io.  This is
handled by the shell.  I also seem to remember from somewhere that the
head and tail of a pipe line aren't buffered.  So you only get shell
buffering in pipelines less then three processes long.

> (Still, I guess it's better than DOS. ``When you say "a | b", you mean
> "a > /tmp/a_out; b < /tmp/a_out", right?'' Geez I hate that)
> 
> Sheesh. I'm using tee(1) because I want _immediate_ output as well as
> just a log, you _stupid_, _stupid_ machine. Bad buffer. Naughty
> buffer. No biscuit.
> 
If you can't wait for the buffer to fill, just use tail.  If you can't
afford the extra process you might try spliting it into two //l commands
and connecting them with a fifo.  It might work, probably worth a try if
its that important.

Andrae Muys

----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list