This question already has an answer here:
- Kill process tree using terminal? 5 answers
Hello I have a bash script that is one liner for executing a piece of long running C++ code. Running
ps -xaf the script is running and C++ code is its child
script.sh \_ long_main.cpp
When i run the code from the command line and press ctrl+C the bash script and the c++ code are interrupted and stop the execution. I love that.
However when i run a script and execute kill -SIGINT PID on my script the script dies, and C++ code runs on. When i run
ps -xaf i see that sh script is dead indeed, but C++ code is running on its own, and it is now a top level process like so:
Could you please elaborate on what is the difference between CRTL+C and kill -SIGINT in this case.