[SunHELP] double IO redirection

sunhelp at sunhelp.org sunhelp at sunhelp.org
Mon Jan 29 16:47:01 CST 2001


On 29-Jan-01 at 11:08, Big Endian (bigendian at mac.com) wrote:
> >You should look at:
> >
> >1) Expect or
> >2) Perl with Net::Telnet
> 
> <snip>
> 
> I have expect statements in there but I'm still trying to figure out 
> how to do the circular I/O.  I don't know perl and I'd like to avoid 
> having to learn just for this one project.

You may be able to do what you want with a named pipe (fifo)
for one of the sets of redirection.  Something like:

	mkfifo mumble
	bash-script < mumble | other-proc > mumble

might do it.  (Note that I haven't tried this; so there's no
guarantees.)  Another possibility would be a simple program
that forks, sets up the stdin<->stdout linkages between the
two branches; and then one exec's the shell and the other the
other program you want.

Also, in any situation where you have two processes communicating
bidirectionally with each other, beware of the need to ensure
sufficient flushing to avoid deadlock.


-Pat



More information about the SunHELP mailing list