Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading the escape key in a script

Status
Not open for further replies.

lmb5kids

Programmer
Dec 18, 2003
36
US
I have a script that I would like the user to be able to press the escape key to exit, how would I go about reading the escape key in a script ?

Thanks for any help.
 
You can try put the following lines at the beginning of your scripts:
savetty=`stty -g`
stty intr '^['
trap 'stty $savetty; exit 0' 0 1 2 3 15

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Congratulations PH, TipMaster of the Week again [thumbsup2].

Jean Pierre.
 
PHV, congrats!

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top