You could also try to set up a simple client-sever system using named pipes (fifos).
You could also try to set up a simple client-sever system using named pipes (fifos). See: Send command to a background process (with further references).
Coproc was the feature I wasn't fully understanding. Great point, thanks. I was easily able to do exactly what I need, the "coproc" process now can easily receive input from the outer script.
– David Parks Jul 6 at 15:24.
A (semi) standard technique for this sort of thing is: #! /bin/sh test -t 1 && { $0 ${1+"$@"} | cat > /tmp/output; exit; } ... If the script is run with stdout on a tty, it is re-run with output piped to the cat.
Function main() { while true; do echo test sleep 1s done } main | cat > /tmp/output.
This might be exactly how I need to think about it. In the actual script, my main() method would be very big, and I think of it as a program in and of its self, perhaps I need to think a bit differently. I'll try this out and report back.
– David Parks Jul 6 at 15:06.
In bash, you can use process substitution to create the subprocess and exec to redirect the script's output: #! /bin/bash exec > >( cat >/tmp/output ) while true; do echo test; sleep 1; done.
Interesting, thanks for that, I had played with this approach but couldn't work out the syntax and thought I was just off base in the attempt. – David Parks Jul 6 at 15:33.
The example is bizarre. Do you want the echo test stdout to be appended to /tmp/output? If so, while true do echo test >> /tmp/output sleep 1 done.
Perhaps a little oversimplified. The echo test essentially replaces a large section of code that monitors a status file for changes, parses it, and ultimately needs to write some results to a socket using netcat (or write to a buffer file if the netcat process isn't able to connect to the server, or if it looses that connection). – David Parks Jul 6 at 15:05.
The ultimate solution, thanks to @jon's pointer to coproc: #! /bin/bash coproc CPO { cat >/tmp/output; } while true; do echo test >&${CPO1}; sleep 1; done In reality 'echo test' is replaced with a complex sequence of monitoring and parsing of a file, and the cat subprocess is replaced with a netcat to a server and that connection is monitored with a trap on the netcat process exiting. Thanks for all the great answers!
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.