Objective: Have program running in the background (with a PID), capture the PID, collect output and kill PID.
tee -a log | program | tee -a log & PID=$! disown $PID sleep 10 pkill '^program*' 2> /dev/null
I ran a variation of different redirect options but I can't seem to have the output being sent to "log".
I've also tried an approach mentioned in a another thread, that recommended the usage of:
program &> log &
Even though that runs fine, it can't seem to capture the output of "program".
"program" is also interactive in a way that it will, for some seconds, output commands, that's why I have the sleep 10 to give it enough time to finish.