LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2004, 05:44 PM   #1
blish_blash
Member
 
Registered: Dec 2003
Posts: 68

Rep: Reputation: 15
bash: character code and keyboard input question


Hi,
Does someone know if I can get a character code out of a string in a bash script?
(like 65 out of "A"...)

In general I search a way to react to single keyboard key-press - (at the moment i am using "read -n 1"), so the next question would be - what about F1..F12 and special keys like [home] [tab] aso.

Is there a better way to trigger and get keyboard input?

Greetings,
BlishBlash :-)

Last edited by blish_blash; 04-08-2004 at 06:17 PM.
 
Old 04-24-2004, 06:09 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Code:
printf '%d' \"A\"
Or similarily with hexdump:
Code:
echo -n 'ABC' | hexdump -e '/1 "%d "'
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SAMBA. Unable to set character code pages Thakowbbery Linux - Software 4 11-23-2005 04:32 AM
Japanese Character Input atheist Linux - Software 1 07-10-2004 11:52 PM
chinese character input and display -- need help carboncopy Slackware 5 07-06-2004 08:12 PM
winkey mapped to multiple character input g-off Linux - General 0 02-24-2004 02:26 AM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 03:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:10 PM.

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
Open Source Consulting | Domain Registration