I'm looking at someone's idea for a project. The person wants to have two programs communicate through pipes. Here is my question. Would creating two programs that communicates with one another through pipes on the command line be possible?
It would be rather easy to have two programs communicate via pipes and set that up from the command line. E.g. on Linux:
$ mkfifo /tmp/A
$ mkfifo /tmp/B
$ /bin/prog1 --inpipe /tmp/A --outpipe /tmp/B &
$ /bin/prog2 --inpipe /tmp/B --outpipe /tmp/A &
$ wait
Or if the programs just want to communicate through standard input and output:
$ /bin/prog1 < /tmp/A > /tmp/B &
$ /bin/prog2 < /tmp/B > /tmp/A &
Or you can even keep one of the pipes anonymous:
$ /bin/prog1 < /tmp/A | /bin/prog2 > /tmp/A
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With