help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Restoring tty line settings after a trap


From: Jesse Molina
Subject: Re: [Help-bash] Restoring tty line settings after a trap
Date: Tue, 17 Jun 2014 14:59:48 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0 SeaMonkey/2.26


Thanks for the advice!  Helpful.  I was not doing this in my traps.



On 6/17/14, 5:00, Greg Wooledge wrote:
However, if you explicitly catch SIGINT, then your script should
kill itself with SIGINT, not just exit, because SIGINT is special.
Seehttp://www.cons.org/cracauer/sigint.html  for details.

In that case, something like this may be required:

cleanup() {
     # remove temp files and so on
     stty sane
}
trap 'cleanup; trap - INT; kill -INT $$' INT
trap 'rc=$?; cleanup; exit $rc' HUP TERM




reply via email to

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