For example, while I am running the script below, if I send an INT signal with Ctrl + C, the script file gets interrupted immediately. But when I try the same process with the kill command as
kill -2 pid, the
sleep command is expected to finish for the interrupt signal to be valid. What exactly is the reason for this situation?
#!/bin/bash trap 'echo signal received!!' SIGINT echo "The script pid is $$" sleep 30
sigintto the script and to
sleep? (My guess is that this is what ctrl-c is doing).