是否有任何 stty 选项可以将终端置于原始模式但仍然让它生成信号,例如CTRL+Z

Is there any stty option that puts the terminal in raw mode but still lets it generate a signal for e.g. CTRL+Z

stty有很多选项。我想要的是基于 stty raw -echo:我想知道我是否可以添加一个选项,使终端驱动程序在看到例如ctrl+z,而不是让我的程序处理这个按键。

sttyraw 选项是 -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -icanon -opost -isig -iuclc -ixany -imax‐ bel -xcase min 1 time 0

的 shorthand

此列表中的 -isig 阻止终端响应例如CTRL-Z

raw之后添加isig(如stty raw -echo isig)将取消-isig中隐含的-isig 10=],并给你一个原始模式的终端,它仍然响应 CTRL-Z(任何字符 INTRQUITSUSPDSUSP,事实上)