[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] How to forbidden SIGINT be propagated from the parent sc
Re: [Help-bash] How to forbidden SIGINT be propagated from the parent script to the child script?
Fri, 29 May 2015 11:03:51 -0400
On Fri, May 29, 2015 at 09:48:05AM -0500, Peng Yu wrote:
> Is there a way to make any scripts (any their child scripts) called by
> the main script not responsive to Ctrl-C?
The obvious way is to ignore SIGINT:
trap '' INT
The less obvious way is to map the terminal driver's intr character to
something other than DEL (System V) or CTRL-C (BSD). For example, to
undefine it completely:
stty intr ^-
Then CTRL-C (or DEL) becomes just another generic character. (Debian's
stty also accepts undef instead of ^- but ^- appears to be the more
Of course, none of this prevents your script's child processes (once
you've run them) from returning intr or SIGINT to their standard settings.