~/ 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/5a7833c8-fff8-4ef9-b42d-acbcad733ef6/flashcard utf-8 LF