bug-bash
[Top][All Lists]
Advanced

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

SIGINT kills interactive shell from dot script


From: Martijn Dekker
Subject: SIGINT kills interactive shell from dot script
Date: Sun, 6 Nov 2016 09:08:47 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

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

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