Let's say I have the following (contrived, simplified example): $ mknod /tmp/fifo $ cat /dev/zero > /tmp/fifo & $ cat < /tmp/fifo
When the first cat exits (i.e. is terminated) the second cat stops. The problem is that I want to be able to restart the first cat and have the second cat just keep reading such as: $ mknod /tmp/fifo $ (n=; while [ $n -lt 10 ]; do cat /dev/zero > /tmp/fifo; let n=$n+1; done) & $ pid=$! $ cat < /tmp/fifo $ kill $pid Where $n is a safety valve against an endless loop of cat just exiting over and over again. But of course that doesn't work because the second cat exits when the first iteration of the first subshell exits. Additionally, the kill only kills the subshell and not any of it's children. So to solve the second cat exiting issue I considered: $ mknod /tmp/fifo $ (n=; while [ $n -lt 10 ]; do cat /dev/zero > /tmp/fifo; let n=$n+1; done) & $ pid=$! $ (n=; while [ $n -lt 10 ]; do cat < /tmp/fifo; let n=$n+1; done) $ kill $pid This has the desired effect except for the issue of not being able to kill $pid's children. So now I figure I must just be going about this all the wrong way. Can anyone help? Ultimately I need to do I/O through a named pipe and I need to be able to restart the writer without restarting the reader. Cheers, b.
signature.asc
Description: This is a digitally signed message part