> at the same prompt you run the script (that fails) from
> what does this command output
> trap
>
Output below, also enhanced with trap command exit stati.
So it looks like in my environment it does not seem to accept the trap
definition (trap trap_QUIT QUIT), however the exit status of that command
is 0.
I also cannot spot anything in my stty environment that would
prohibit the SIGQUIT. The 'isig' stty flag does not seem to make a
difference either way
Thanks,
--Marcus
$ ./ttt.ksh
0
0
0
0
From main program:
trying to trap SIGINT ...signal INT trapped
trying to trap SIGQUIT ...
trying to trap SIGTERM ...signal TERM trapped
trying to trap SIGHUP ...signal HUP trapped
trap -- trap_TERM TERM
trap -- '' QUIT
trap -- trap_INT INT
trap -- trap_HUP HUP
end
$ stty -a
speed 38400 baud; rows 33; columns 96;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2
= M-^?; swtch = <undef>;
start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc -ixany
imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0
vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt echoctl echoke
$ cat ttt.ksh
#!/usr/bin/ksh
trap trap_INT INT
echo $?
trap trap_QUIT QUIT
echo $?
trap trap_TERM TERM
echo $?
trap trap_HUP HUP
echo $?
function trap_INT {
print "signal INT trapped"
}
function trap_QUIT {
print "signal QUIT trapped"
}
function trap_TERM {
print "signal TERM trapped"
}
function trap_HUP {
print "signal HUP trapped"
}
function trap_ERR {
print "ERR trapped"
}
print "From main program: "
print -n " trying to trap SIGINT ..."
/usr/bin/kill -INT $$
print ""
print -n " trying to trap SIGQUIT ..."
/usr/bin/kill -QUIT $$
print ""
print -n " trying to trap SIGTERM ..."
/usr/bin/kill -TERM $$
print ""
print -n " trying to trap SIGHUP ..."
/usr/bin/kill -HUP $$
print ""
trap
print "end"