Objective: Have program running in the background (with a PID), capture the PID, collect output and kill PID.My code:tee -a log | program | tee -a log &PID=$!disown $PIDsleep 10pkill '^program*' 2> /dev/nullI 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. Any tips?Thank you!
Redirect output from background process
bash;shell script;io redirection