help-bash
[Top][All Lists]
Advanced

[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


From: Peng Yu
Subject: Re: [Help-bash] How to forbidden SIGINT be propagated from the parent script to the child script?
Date: Fri, 29 May 2015 10:17:48 -0500

On Fri, May 29, 2015 at 10:03 AM, Greg Wooledge <address@hidden> wrote:
> 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?

I assume that these changes should be done in the child scripts. Is
there a way to modify the calling scripts so that child scripts will
called in a way such that Ctrl-C does not have any effects on them?

> 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
> common/portable way.)
>
> 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.



-- 
Regards,
Peng



reply via email to

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