79156259

Date: 2024-11-04 16:35:55
Score: 0.5
Natty:
Report link

The key here is that when you create a subprocess that the PID you get back is for the shell of the subprocess. So, what you want to do is to use pkill -P to kill all the children of the child shell:

(sh child1.sh) &
child=$!
sh child2.sh
pkill -P "$child"
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Compholio