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

[ale] bash scripting

On Mon, 17 Nov 1997, David Hamm wrote:

> I'm writing a bash print filter to load balance several printers.  I'm now to
> the point where I need to direct the print data to the desired printer.  How do
> I run a child binary that receives its data from stdout of the parent?

	Assuming something like "foo | bar" doesn't work, the next thing 
that comes to mind for me is "mkfifo", ie:

mkfifo /tmp/foobarfifo
parent > foobarfifo
child < foobarfifo
rm /tmp/foobarfifo

	If you actually need to do this redirection with C code (not 
through bash), then I would suggest looking at the man pages for either 
pipe(2), dup(2) or dup2(2).

							Hope this helps,
								- Mike
Michael Kachline - CS, Georgia Tech
kachline at cc.gatech.edu