terminalgnome-terminalstty

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


There are many options for stty. What I want is based on stty raw -echo: I'm wondering if I can add an option that makes the terminal driver send a signal when it sees e.g. ctrl+z, instead of having my program handle this keypress.


Solution

  • The raw option for stty is shorthand for -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -icanon -opost -isig -iuclc -ixany -imax‐ bel -xcase min 1 time 0

    The -isig in this list prevents the terminal from responding to e.g. CTRL-Z

    Adding isig after raw (like in stty raw -echo isig) will cancel the -isig that is implicit in raw, and give you a terminal in raw mode that still responds to CTRL-Z (any of the characters INTR, QUIT, SUSP, or DSUSP, in fact)