bug-bash
[Top][All Lists]
Advanced

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

Re: trap: interactive bash exits on resending SIGINT twice


From: Chet Ramey
Subject: Re: trap: interactive bash exits on resending SIGINT twice
Date: Wed, 15 Jan 2020 15:12:08 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.3.1

On 1/14/20 11:24 AM, Martijn Dekker wrote:
Setting the following trap makes an interactive bash (any version) exit on issuing SIGINT:

trap 'trap "true" INT; kill -s INT $$; trap - INT; kill -s INT $$' INT
#     ^^^^^^^^^^^^^^^ eat signal       ^^^^^^^^^^ unset trap

After setting that trap, pressing Ctrl+C, or otherwise causing SIGINT to be sent, causes an interactive bash to exit.

Thanks for the report.

Chet


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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