[svlug] Extended Keyboard Input Utility For Bash?
Mark S Bilk
mark at cosmicpenguin.com
Fri Mar 23 19:01:59 PDT 2007
Does anyone know of a utility program that reads a single
keystroke -- which may be an extended key (keypad or
function key) -- and sends to stdout either a single ASCII
character or a multicharacter word like UP, DOWN, PGUP,
F1, etc. The translations of the escape codes for the
extended keys should be derived from termcap, terminfo,
or ncurses.
The goal is to write interactive bash scripts. I know
I can get a single byte in bash like this:
stty raw -echo
char=`dd if=/dev/tty bs=1 count=1 2>/dev/null`
stty -raw echo
And I've written a C program to return the extended
codes like UP and F1, but it has a fixed translation
for the escape sequences (for KDE konsole) implemented
as a decision tree.
I figure this is a problem that has been solved many
times, so before I bite the bullet and deal with
terminfo, etc., I thought I'd ask. I've searched
with no success.
Mark
More information about the Svlug
mailing list