Here's a simplified example of a script I'm writing (doesn't work as is).
I want to direct STDOUT from my script to the STDIN of a subprocess.
In the example below I'm writing 'test' to STDOUT and want that to get to the subprocess which ultimately writes it to the file output.
#!/bin/bash
exec 4<&1
( cat >/tmp/output )& <&4
while true; do echo test; sleep 1; done