I have an app that launches an authentication helper (my script) and uses STDIN/STDOUT to communicate.
I want to re-direct STDIN and STDOUT from this script to two named pipes for interaction with another program.
SCRIPT_STDIN > pipe1
SCRIPT_STDOUT < pipe2
Here is the flow I'm trying to accomplish:
[Application] -> Launches helper script, writes to helpers STDIN, reads from helpers STDOUT (example: STDIN:username,password; STDOUT:LOGIN_OK)
[Helper Script] -> Reads STDIN (data from app), forwards to PIPE1; reads from PIPE2, writes that back to the app on STDOUT
[Other Process] -> Reads from PIPE1 input, processes and returns results to PIPE2
The cat command can almost do what I want. If there were an option to copy STDIN to STDERR I could make cat do this with a command (assuming the fictitious option -e echos to STDERR rather than STDOUT):
cat -e PIPE2 2>PIPE1 (read from PIPE2 and write it to STDOUT, copy input, normally going to STDERR to PIPE1)