I have two programs, prog1 and prog2, prog2 takes the PID of prog1 as argument and they have to run in parallel.
I need stdin and stdout of prog1 to stay connected to the shell, note that it's not an interactive shell.
I tried like this, but stdin of prog1 is not connected to the shell:
#!/bin/bash
./prog1 & (./prog2 $! 1>&2 0<&-)
fg