-   Linux - General (
-   -   shell for READKEY (

Rex_chaos 06-23-2002 02:08 AM

shell for READKEY
Hello all,
I would like to write a shell to read a UP, DOWN, LEFT and RIGHT key in and output a corresponding message. However, I found "read" function don't know how to read the special key as the key value. Does anyone have idea?


kop 06-28-2002 05:34 PM

I don't think there is a "special value", just some odd characters.

[root@mofo X11]# cat -v -

(I typed the up arrow key, then the return key, then Ctl-d.)

So, up arrow is Ctl-[, followed by [, followed by A.

You may need to turn off command line editing with --noediting
when starting the shell, or you may never see the keys used for editing...

Have your script start with
#!/bin/bash --noediting

(I think.)

(man bash)

All times are GMT -5. The time now is 11:03 AM.