LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 06-23-2002, 03:08 AM   #1
Rex_chaos
Member
 
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?

Thanks.
 
Old 06-28-2002, 06:34 PM   #2
kop
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 -
^[[A
^[[A


(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)
 
  


Reply


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 09:30 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 03:14 AM
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 10:20 AM
Installing XMLTV; ReadKey.pm error shubb Linux - Software 2 09-12-2005 04:13 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 04:00 PM


All times are GMT -5. The time now is 02:39 AM.

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