So I keep reading everywhere that this command should terminate all child processes of the parent process:
kill -- -$$
Using a negative ID with the kill command references a PGID and from the examples I have seen it appears the PGID of child processes should be the PID of the parent but its not the case on my system.
On my system the PGID of the child is the same as the PGID of the parent script which turns out to be bash.
What's going on here? Were the examples wrong or is my system set up differently?
What I need to achieve is to terminate child processes without terminating the parent so I don't want to send a kill signal to the PGID the parent is in.