![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Func 0.16 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-06-2008 09:30 PM |
| FLOOR Func | user_prady | Shell Programming and Scripting | 1 | 10-17-2007 03:16 AM |
| difference between int ** func() and int *& func() | devesh | High Level Programming | 1 | 12-05-2005 11:34 AM |
| command utilizing high CPU | azmanw2004 | Shell Programming and Scripting | 6 | 06-07-2005 06:26 AM |
| arrow keys / special keys | raguramtgr | UNIX for Dummies Questions & Answers | 3 | 02-19-2004 11:45 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I would like to have the function keys available to me in my scripts. Anyone have any ideas on how to map these to functionality I design?
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Hi,
Well after some research this is what i can say. I use k-shell. on the prompt, if I press the ctrl-v and then the F1 key, i see the characters ^[OP. these are 3 characters. So I wrote a small function getch as follows function getch { stty raw typeset x x=`dd bs=1 count=3` stty -raw echo $x } So when I have to check for say F1 in a script I use it as keyPressed=`getch` if [ "${keyPressed}" = "^[OP" ]; then ## the ^[OP is not those characters, but it is 3 characters that i get after typing ctrl-v followed by F1 echo " You typed F1" fi Hope this helps.
__________________
War doesnt determine who is right, it determines who is left |
|
#3
|
|||
|
|||
|
hmmm...
First off, thank you for your effort it is much appreciated. Secondly, can you explain each step in you getcha function.
|
|
#4
|
|||
|
|||
|
Hmm.
The stty command allows you to map control keys to tty functions like erase Code:
stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^z" kill "^o" Some terminal emulators allow you to map functions keys to actual UNIX commands, but this is not specific to UNIX itself. An example is secureCRT from Vandyke Technologies. |
|||
| Google The UNIX and Linux Forums |