01-03-2009
how2 get single char from keyboard w/o enter
I am writing a bash shell menu and would like to get a char immediately after a key is pressed. This script does not work but should give you an idea of what I am trying to do....
Thanks for the help
#! /bin/bash
ANSWER=""
echo -en "Choose item...\n"
until [ $ANSWER <> null ]
do
$ANSWER = $STDIN
sleep 1
done
echo -en "You pressed $ANSWER\n"
9 More Discussions You Might Find Interesting
1. Programming
Hello,
I'm trying to write a method which will return the extension of a file given the file's name, e.g. test.txt should return txt. I'm using C so am limited to char pointers and arrays. Here is the code as I have it:
char* getext(char *file)
{
char *extension;
int i, j;... (5 Replies)
Discussion started by: pallak7
5 Replies
2. Shell Programming and Scripting
How do I place the result of a shell command into a variable. I would like to save the pwd in $DIR. I tried...
pwd | $DIR
$DIR < pwd
DIR=pwd
thanks! jz (2 Replies)
Discussion started by: jwzumwalt
2 Replies
3. UNIX for Dummies Questions & Answers
I'm trying to run a script which will ssh to several other servers (All Solaris 10) and execute a sar -f command to get each server's CPU usage for a given hour.
It kinda works OK but I just can't figure out how to separate the returned fields with a Tab character. I've done lots of searching... (2 Replies)
Discussion started by: jake657
2 Replies
4. Shell Programming and Scripting
Hello,
Need help substituting a particular word in a file having a single line but no newline character at the end.
I was trying to use sed but it doesn't work probably because there is no newline char at the end of the line.
$ cat hlq_detail
/outputs/alvan23/PDFs/bills
$ cat... (5 Replies)
Discussion started by: Shan_u2005
5 Replies
5. Shell Programming and Scripting
Hi All,
I have 4 big files which contains one big line containing formatted character records, I need to format each file in such way that each File will have 95 Characters per line. Last line of each file will have newline character at end.
Before:-
File Name:- File1.dat
102 121340560... (10 Replies)
Discussion started by: lancesunny
10 Replies
6. Shell Programming and Scripting
Task 2:
When Im tring script called char that checks a single character on the
command line, c. If the character is a digit, digit is displayed. If the
character is an upper or lowercase alphabetic character, letter is
displayed. Otherwise, other is displayed. Have the script print an
error... (0 Replies)
Discussion started by: Roozo
0 Replies
7. UNIX for Dummies Questions & Answers
Hi
I've a string . And i need to replace set of characters with a single character
Means .. or . or ... and so on should be replaced with single % character
Irrespective of number of dots in between the characters , those should be replaced with single %
All the above strings should be... (3 Replies)
Discussion started by: smile689
3 Replies
8. Shell Programming and Scripting
How to change the uploaded weekly file data to the following format?
New Well_Id,Old Well_Id,District,Thana,Date,Data,R.L,WellType,Lati.,Longi.
BAG001,PT006,BARGUNA,AMTALI,1/2/1978,1.81,2.29,Piezometer,220825,901430
BAG001,PT006,BARGUNA,AMTALI,1/9/1978,1.87,2.29,Piezometer,220825,901430... (3 Replies)
Discussion started by: sara.nowreen
3 Replies
9. Shell Programming and Scripting
have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value
File 1
export SERVER_CONNECTION=//dvlna002:10001/SmartServer
File2
export SERVER_CONNECTION=///SmartServer
File3
export... (1 Reply)
Discussion started by: Nsharma3006
1 Replies
LEARN ABOUT DEBIAN
keyboard_translatekeys
keyboard_translatekeys(3) Svgalib User Manual keyboard_translatekeys(3)
NAME
keyboard_translatekeys - modify scancode mappings in raw keyboard mode
SYNOPSIS
#include <vgakeyboard.h>
void keyboard_translatekeys(int mask);
DESCRIPTION
This function sets several flags which control how certain scancodes are mapped. At startup a mask value of 0 is active.
mask must be a logical or of zero or more of the following #predefined integers to turn the features listed on:
TRANSLATE_CURSORKEYS
Translate the scancodes of the SCANCODE_CURSORBLOCK* keys to those of the cursor keys on the number pad, s.t. keyboard_getstate(3)
and keyboard_keypressed(3) report a keypress of the corresponding number pad cursor key and not the one on the cursor block.
TRANSLATE_DIAGONAL
Translates the scancodes of diagonal cursor keys (keypad 7, 9, 1, 3) to presses of two of the ordinary up, down, left, right keys.
For example, instead of reporting a press of SCANCODE_CURSORUPRIGHT keyboard_getstate(3) and keyboard_keypressed(3) report a simul-
taneous press of SCANCODE_CURSORUP and SCANCODE_CURSORRIGHT.
TRANSLATE_KEYPADENTER
The scancode of the keypad enter key is mapped to that of the ordinary enter key, s.t. keyboard_getstate(3) and keyboard_key-
pressed(3) report a press of SCANCODE_ENTER regardless if keypad enter or ordinary enter is pressed.
DONT_CATCH_CTRLC
Pressing <Ctrl>-C does not raise a SIGINT. On contrary to the other flags this has also effect when a user defined keyboard event
handler is used. Svgalib will always process <Alt>-F1 - <Alt>-F10 and perform console switches accordingly.
BUGS
The TRANSLATE_* options above do really do simple scancode translations. For example, when TRANSLATE_KEYPADENTER is active and the user
presses both enter and keypad enter. Then, if he releases one of them (say keypad enter), it's release event will clear the common keyboard
state, s.t. no keypress is reported even though enter is still pressed.
Similarly, if TRANSLATE_DIAGONAL is active, the user holds cursor upleft (keypad 7) down and then presses and release cursor up (keypad 8),
svgalib will only report a pressed cursor left but the simulated cursor up will be lost. You can easily try this with the keytest(6) demo
to make the effect more clear to you.
SEE ALSO
svgalib(7), vgagl(7), libvga.config(5), keytest(6), eventtest(6), keyboard_seteventhandler(3), keyboard_init(3), key-
board_init_return_fd(3), keyboard_close(3), keyboard_update(3), keyboard_waitforupdate(3), keyboard_setdefaulteventhandler(3), key-
board_getstate(3), keyboard_clearstate(3), keyboard_keypressed(3), vga_waitevent(3)
AUTHOR
This manual page was edited by Michael Weller <eowmob@exp-math.uni-essen.de>. The exact source of the referenced function as well as of the
original documentation is unknown.
It is very likely that both are at least to some extent are due to Harm Hanemaayer <H.Hanemaayer@inter.nl.net>.
Occasionally this might be wrong. I hereby asked to be excused by the original author and will happily accept any additions or corrections
to this first version of the svgalib manual.
Svgalib (>= 1.2.11) 29 July 1997 keyboard_translatekeys(3)