# Keep a fifo open by shell-script

I try to start processes by script, which can interact.

EDIT: The general issue is to start these processes via php. After the process is started, another php-script (or the same running again) shall read the output of the process. Than a third php-script shall write to the input of the process. To simulate the start by php I did use a bash-script, because it has the same problems.

For this, I create an out-file, the process can write to, and a fifo, the process reads from. My process is, eg, passwd.

When I try it like this:

mkfifo fifo.my
touch out.my
passwd > out.my 2> out.my < fifo.my & echo $!  it does not work. According to this posting a EOF causes termination of the passwd-Process. Following the solution of the mentioned posting, I tried mkfifo fifo.my touch out.my cat > fifo.my & passwd > out.my 2> out.my < fifo.my & echo$!


which creates two jobs which I can watch with

jobs


My target is, to start this via bash-script

#!/bin/bash
cat > fifo.my & PID=$! echo$PID


When I do call the script, a Process with PID = $PID is created, but not a job. And, much more important, passwd > out.my 2> out.my < fifo.my & echo$!


does not work, because again an EOF is send through the pipe.

How can I keep the pipe open from a script?

-