home Mail List
Info
Info
Meetings
Goals
Upcoming
Projects
FAQ
Security
Links

[Date Prev][Date Next] [Chronological] [Thread] [Top]

[NMLUG] Random questions #26 (now tee...)



On Thu, 2004-11-11 at 18:55, Sarang wrote:
> Short random questions (w/ footnotes) if anyone can help:
> 
> % Can I pipe one program's stdout to 2 programs at the same time? [1]

One could create a named pipe to one program, then use
tee (see man tee) to send stdout to one program, AND
the named pipe, which is stdin to another program.

I could help you write a program, like tee, that would
do this.  I did something like this about a decade before.

The program will take as arguments the two programs
you want to pipe to.
The program will fork these two programs off, retaining
the handles for their stdin streams.

Then this program can take its input, and print it out to
BOTH of the stding streams.   I bet it can be
done in 30-50 lines.
Some of the forks and device retaining stuff gets tricky
(for a non-system-programming-guru like me at least)

    aaron




Please send sugestions and comments to webmaster@nmlug.org.
Valid XHTML 1.1! Valid CSS! Powered by Debian Powered by Apache