~/ learn/ comp-325/ cards/ onintr, and why C shell scripting lost
1 of 10

Ignoring the interrupt while the terminal is locked

Ignoring the interrupt while the terminal is locked

Answer

#!/bin/csh onintr - stty -echo echo -n "Locked. Password: " set guess = $< stty echo echo ""

`onintr -` is the C shell spelling of `trap '' INT`. Without it a Ctrl-C during the read would leave echo off and the terminal unusable — which is exactly the failure the ignore form exists to prevent.

S&K 3e ch15 §15.5-15.6; csh(1)

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/24c07180-49ec-494b-8325-fb27555f94f3/flashcard utf-8 LF