An interactive bash is killed by SIGINT after a command to unset any
trap for SIGINT.

$ cat >/tmp/dotscript <<EOF
trap
trap - INT
kill -s INT "$$"
EOF
$ . /tmp/dotscript
(no output of 'trap')
(interactive shell exits)

As far as I can determine, this behaviour is unique to bash. I think
this is a bug, particularly because it makes Ctrl+C have the same effect:

$ cat /tmp/dotscript2
trap - INT
echo "Try pressing Ctrl-C"
read junk
$ . /tmp/dotscript2
Try pressing Ctrl-C
^C
(interactive shell exits)

Interestingly, the shell does not exit without the "trap - INT",
although no trap was set for INT to begin with (as shown by the empty
output of "trap").

- M.

Reply via email to