Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 763
Herbert Avatar asked Sep 03 '25 15:09

Herbert


1 Answers

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)

like image 90
Hans Lub Avatar answered Sep 05 '25 15:09

Hans Lub