I'm implementing the logging solution presented here and I don't know if the following lines are required whenever I exit the parent bash process/script:
if [ -n "$teepid" ]; then
exec 1>&- 2>&- # close file descriptors to signal EOF to the `tee`
# command in the bg process
wait $teepid # wait for bg process to exit
fi
Those lines can be found in the log() function and in the end of the script. I know that they're required in the log() function, but are they required at the end of the script?
In other words: Would my background job exit nicely without having the aforementioned code written before every exit command in my parent process?