So I have a small script that I run as source (for those interested, I do this so that I can attain the correct $SECONDS value of the person running the script), as well as place the program in the background. Inside of this script there is an infinite loop that runs to update a temp file every second.So my question, how do I attain the PID of the loop inside the script that needs to be terminated to kill the updating of the temp file/the script?
Getting the PID of a backgrounded process that is run through source
shell script;background process