help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] What is the effect of `kill -s INT -$$` within the INT trap


From: Peng Yu
Subject: [Help-bash] What is the effect of `kill -s INT -$$` within the INT trap of the same script?
Date: Mon, 17 Dec 2018 14:18:26 -0600

Hi,

I am not sure if I understand the following behavior correctly. If I
call `kill -s INT -$$` within the INT trap, why the INT trap is only
called one?

Is the second INT signal caused by kill ignored by the process
somehow? Could anybody help explain this? Thanks.

$ ./main.sh
^Cbegin INT
end INT
$ cat ./main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

trap 'echo begin INT; kill -s INT -$$; echo end INT' INT
sleep 10

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]