How to read arrow keys on really old bash?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 05-01-2006
How to read arrow keys on really old bash?

I would like to get a script to respond to arrow key presses to scroll up and down a menu.

The platform is CDLinux which uses a prehistoric version of bash, version 1.14.7.

I would like to do something like "read -sn 1 keyin" but the "read" command is so primative that it only has the -r switch available so it is not possible, as far as I can see, to read single keystrokes, only whole lines.

Is there any way to detect arrow keys in this backwater of a bash shell?
# 2  
Old 05-01-2006
OK. Found out how to do it.

PHP Code:
stty_state=`stty -g`
stty rawstty -echo
keycode=`dd bs=1 count=1 2>/dev/null`
stty "$stty_state
Where keycode contains the key code.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Read a multiline text from a console - supporting arrow keys wenclu Shell Programming and Scripting 8 10-16-2012 01:51 AM
Arrow keys binding in AIX v5.3 - how? alex_5161 UNIX for Dummies Questions & Answers 2 12-22-2011 06:40 PM
Tux-HJKL as arrow keys dotancohen UNIX for Dummies Questions & Answers 2 09-01-2011 04:14 PM
How to read keys from USB keyboard on AT91SAM9260 siva4ever Linux 7 11-10-2009 10:19 AM
SSH closes connection when using arrow keys stv_t UNIX for Advanced & Expert Users 0 09-17-2009 06:53 AM
problem using arrow keys in bash shell Moumou Shell Programming and Scripting 2 07-17-2009 03:14 AM
Using arrow keys in shell scripts cambridge Shell Programming and Scripting 4 05-26-2009 06:15 AM
[Bash] Send Keys help mikejreading Shell Programming and Scripting 3 03-22-2009 10:22 PM
How does BASH handle KEY BOARD "up arrow"?? nsharath Shell Programming and Scripting 1 01-27-2009 09:23 AM
SunOS 5.10 - VI Arrow keys not working ravashingravi UNIX for Dummies Questions & Answers 7 12-01-2008 10:22 AM
command scrolling using arrow keys hemangi13 UNIX and Linux Applications 4 09-11-2008 12:53 PM
Using arrow keys cooldude Solaris 4 06-13-2008 11:51 AM
how do I get my arrow keys to work for looking thru my PREVIOUS UNIX COMMANDS spotnis UNIX for Dummies Questions & Answers 11 09-14-2005 01:22 AM
arrow keys / special keys raguramtgr UNIX for Dummies Questions & Answers 3 02-20-2004 01:45 AM
Trapping Arrow keys nageshrc Shell Programming and Scripting 1 11-30-2001 02:36 PM