Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 06-23-2002, 02:08 AM   #1
Registered: Aug 2001
Location: GD, GZ, China
Posts: 240

Rep: Reputation: 30
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?

Old 06-28-2002, 05:34 PM   #2
LQ Newbie
Registered: Jul 2001
Posts: 24

Rep: Reputation: 15
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)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between normal shell and login shell Manish Linux - General 7 11-14-2012 08:30 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
Installing XMLTV; error shubb Linux - Software 2 09-12-2005 03:13 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

All times are GMT -5. The time now is 09:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration