【发布时间】:2016-09-13 21:41:00
【问题描述】:
问题: ctrl+U 不会杀死我的终端程序。
详情:这是我来自ssty --all的结果:
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
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
如您所见,它描述了可用的信号中断:
^C = intr
^ \ = 退出
^U = 杀死
等等……
这是一个无限运行的程序:
int main (){while(true){}}
ctrl+C 有效
$./main
^C
$
ctrl+\有效
$./main
^\[1] 6331 quit (core dumped) ./main
$
ctrl+U 不起作用。
为什么我不能以这种方式杀死终端程序?
我当然可以找到进程 ID 并运行 kill -9 <PID>,
但我希望速记工作。
我在 Ubuntu 上:
lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
这是我的终端规格,但我尝试过其他终端(可能不相关)
gnome-terminal --version
GNOME Terminal 3.6.2
它也不适用于 xterm。我也尝试过不同的 shell:sh、bash、ans zsh。
可能是什么问题?我现在应该去哪里看?
【问题讨论】:
标签: shell terminal signals ubuntu-14.04 stty