Is there a command runner like env
, nice
, nohup
, etc., that can run a program with modified signals? In my case, I need something to reset SIGINT
to SIG_DFL
.
Why do I need this? Because non-interactive bash
sets SIG_IGN
for SIGINT
for background processes and you can't reset it with the shell built-in trap
: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=573780
upd: in bash 4.3 background subshell does not ignore SIGINT, other background programs still do
http://tiswww.case.edu/php/chet/bash/CHANGES
h. Fixed a bug that caused SIGINT and SIGQUIT to not be trappable in
asynchronous subshell commands.
Best Answer
There is no. Very easy to write one with perl. Here's
untrap
script:Example usage:
If you remove
untrap
prefix, Ctrl-C won't kill the script.More versatile script: