[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] read -s -n 1 REPLY values
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] read -s -n 1 REPLY values |
Date: |
Mon, 19 Mar 2012 08:50:59 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Mar 18, 2012 at 01:13:21PM -0600, Bill Gradwohl wrote:
> For example, the Home key produces \E O H
> keypad Home produces \E [ 1 ~
>
> Is there a known map of what will be returned per key?
This is defined by your terminal. If your operating system's terminfo
or termcap database is up to date, and if your TERM variable is correctly
set, then you could in theory look up the keystroke escape sequences in
terminfo/termcap. This is what C programs do.
Quite frankly, I would not even attempt that in a bash script. Use a
language that has actual support for this. Even in C, I wouldn't write
it by hand -- I'd use a library (like curses). That's what they're for.
> Does what gets returned vary by being in a Gnome 3 terminal session vs
> a tty terminal session?
Absolutely. xterm, rxvt, rxvt-unicode, aterm, Eterm, gnome-terminal,
Konsole, hpterm, dtterm, Linux text console, ... are all different.