I start a background process from my shell script, and I would like to kill this process when my script finishes.
How to get the PID of this process from my shell script? As far as I can see variable $!
contains the PID of the current script, not the background process.
this is what I have done. Check it out, hope it can help.
Then just run it as:
./bgkill.sh
with proper permissions of course