I have two processes that interface with one another over stdin and stdout.
Suppose I have process A and process B. The stdout of B needs to feed into the stdin of A, and the stdout of A needs to feed in to that of process B.
Is there a simple way to express this relationship in a simple command, or is there a basic shell script that can enable this?
Thanks in advance.
Take a look at named pipes. Create one pipe for A to B, and one pipe for B to A. Then start A with its stdout redirected to the first, and its stdin redirected to the second. Then start B with the opposite.
It would look something like this:
add: Of course, they’ll need some way to recognize that both parties are present. Something like a simple “I am here, are you?” that both receive a response to.
Important: As noted in comments below, this process will deadlock with both programs blocking on reads. Some form of coordination will be necessary to ensure this doesn’t happen.