Re: SIGINT kills interactive shell from dot script

2016-11-09 Thread Chet Ramey
On 11/8/16 1:50 PM, Martijn Dekker wrote: > Works as expected: The 'trap' command is on the same command line as the > loop. The signal is properly ignored, the trap is properly executed > repeatedly on pressing Ctrl+C. > > $ trap 'echo INT' INT; i=0; while [ $((i+=1)) -lt 100 ]; do :; done >

Re: SIGINT kills interactive shell from dot script

2016-11-08 Thread Martijn Dekker
Op 08-11-16 om 14:38 schreef Chet Ramey: > On 11/7/16 7:54 AM, Martijn Dekker wrote: > >> But it's really helped that bash turns out to have another unique >> behaviour: apparently, bash refuses to ignore SIGINT on interactive >> shells. So, for interactive bash, the workaround is simply to avoid

Re: SIGINT kills interactive shell from dot script

2016-11-08 Thread Chet Ramey
On 11/7/16 7:54 AM, Martijn Dekker wrote: > But it's really helped that bash turns out to have another unique > behaviour: apparently, bash refuses to ignore SIGINT on interactive > shells. So, for interactive bash, the workaround is simply to avoid > using "trap - INT" to unignore the signal. Wh

Re: SIGINT kills interactive shell from dot script

2016-11-07 Thread Martijn Dekker
Op 06-11-16 om 16:52 schreef Chet Ramey: > On 11/6/16 4:08 AM, Martijn Dekker wrote: >> An interactive bash is killed by SIGINT after a command to unset any >> trap for SIGINT. >> >> $ cat >/tmp/dotscript <> trap >> trap - INT >> kill -s INT "$$" >> EOF >> $ . /tmp/dotscript >> (no output of 'trap'

Re: SIGINT kills interactive shell from dot script

2016-11-06 Thread Chet Ramey
On 11/6/16 4:08 AM, Martijn Dekker wrote: > An interactive bash is killed by SIGINT after a command to unset any > trap for SIGINT. > > $ cat >/tmp/dotscript < trap > trap - INT > kill -s INT "$$" > EOF > $ . /tmp/dotscript > (no output of 'trap') > (interactive shell exits) You're on a roll find

Re: SIGINT kills interactive shell from dot script

2016-11-06 Thread Martijn Dekker
Op 06-11-16 om 09:08 schreef Martijn Dekker: > An interactive bash is killed by SIGINT after a command to unset any > trap for SIGINT. ...if executed in a dot script, that is (in case that wasn't clear from the subject line and the code examples). Another datapoint: the same phenomenon occurs if