I have a shell script running in the background, which runs 5 different jobs.
When I run the shell script all 5 jobs start running in order. When I kill this shell, whichever process is running, will still continue to run, even though I have killed the shell.
$ bash shell.sh & echo $!
this gives me the PID of the shell, which allows me to kill it later if I wish to do so at some point.
#!/bin/bash
JOB1
JOB2
JOB3
JOB4
JOB5
How can I make the shell kill all process running within, once it has been killed?