I can write shell scripts that catch SIGINTjust fine, but I can't catch SIGQUIT.
#!/bin/bash
function die {
echo "Dying on signal $1"
exit 0
}
trap 'die "SIGINT"' SIGINT
trap 'die "SIGQUIT"' SIGQUIT
while true; do
echo "sleeping..."
sleep 5
done
Running this script and pressing CTRL-Chas the desired effect, but pressing CTRL-\(which, as I understand it, should run SIGQUIT) does nothing except print ^\in the terminal. Why?
I have two running theories. Firstly, semantics SIGINT, and SIGQUITis different in that SIGQUITonly sent to the child process sleep, and SIGINTsent to the child process and the parent process of bash, if so, where it documented?
, bash (.. no-op ) SIGQUIT ( ), . , , SIGQUIT , , (bash) . , SIGQUIT bash script?... , shopt ?
: Ubuntu 10.10 gnome-terminal 2.32.0 bash 4.1.5 yes ^\ SIGQUIT ( stty -a) ^\ SIGQUITs , ping).
UPDATE:
, - -. script (.. ctrl-alt-f1, X), SIGQUIT, ^\. bash , . , : gnome-terminal, ? diff 'd stty -a gnome-, , (, quit = ^\;).
2:
. $ sleep 60 gnome-terminal; ^\, . $ sleep 60 ; ^\ - Quit . $ ping google.com gnome-terminal ^\ - , . , - gnome-, SIGQUIT , , do . , -.