I would like to write a script that starts a process in a
screen, letting it continue to run, but extracts a certain part of the output for use in the main process of the script.
My first idea was to use a named pipe to communicate between the two processes. However, using an actual named pipe just causes the script to hang forever -- the screen boots up and runs fine, and I can access it later, but the terminal process just hangs without returning:
pipe=/tmp/fwdpipe$$ trap "rm -f $pipe" exit mkfifo $pipe server=$(cat $pipe) & screen -dmS jupyter screen -S jupyter -X stuff "cat foo" > $pipe\015" wait echo $server
(The background-and-wait pattern is an experiment; the problem persists if I move the
server= line to the end.)
If I use a normal file instead, the
cat complains that the file doesn't exist. Either way, I can't seem to achieve that original goal of communicating from within a