Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15848
| From | Roger <rogerx.oss@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Protect Loop Execution with Traps |
| Date | 2020-01-29 15:19 -0500 |
| Message-ID | <mailman.63.1580329155.2384.bug-bash@gnu.org> (permalink) |
| References | (3 earlier) <20200128204932.GB12574@localhost4.local> <20200128210721.GU1350@eeg.ccf.org> <59.1580277932@jinx.noi.kre.to> <20200129143352.GY1350@eeg.ccf.org> <20200129201907.GA17112@localhost4.local> |
>sigint_handler() {
> trap - INT
> kill -INT $$
>}
>trap sigint_handler INT
One thing to note here, I tried inserting the "trap sigint_handler INT" prior
to the loop/for/while statement (or outside of the loop) and the trap doesn't
work as you state it does for yourself.
I find I have to insert "trap sigint_handler INT" within my loop (for/while)
section of code, for the trap to work. In my eyes or for me, this works as
expected.
--
Roger
http://rogerx.sdf.org/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Protect Loop Execution with Traps Roger <rogerx.oss@gmail.com> - 2020-01-29 15:19 -0500
csiph-web