Sponsored Content
Full Discussion: detect F5 is pressed
Top Forums Shell Programming and Scripting detect F5 is pressed Post 302309005 by cfajohnson on Tuesday 21st of April 2009 01:18:43 AM
Old 04-21-2009
Code:
case $x in
  $'\e[11~' | $'\e[OP') key=F1 ;;
  $'\e[12~' | $'\e[OQ') key=F2 ;;
  $'\e[13~' | $'\e[OR') key=F3 ;;
  $'\e[14~' | $'\e[OS') key=F4 ;;
  $'\e[15~') key=F5 ;;
  $'\e[16~') key=F6 ;;
  $'\e[17~') key=F7 ;;
  $'\e[18~') key=F8 ;;
  $'\e[19~') key=F9 ;;
  $'\e[20~') key=F10 ;;
  $'\e[21~') key=F11 ;;
  $'\e[22~') key=F12 ;;
  $'\e[A' ) key=UP ;;
  $'\e[B' ) key=DOWN ;;
  $'\e[C' ) key=RIGHT ;;
  $'\e[D' ) key=LEFT ;;
  ?) key=$x ;;
  *) key=??? ;;
esac

echo "You have pressed $key"

 

10 More Discussions You Might Find Interesting

1. Programming

know what key is pressed

hi i´m making a program, and i would like to know how can i know what key was pressed. i'm using Sun5.7 and C. is there a keypress/keypressed function in C? how can i know recognize the keys (enter, tab, shift, etc.)? can i recognize two keys ? (shift+A, ctrl+C, etc) any idea.. thanks (4 Replies)
Discussion started by: DebianJ
4 Replies

2. Shell Programming and Scripting

How to identify whether the return key is pressed ??

I want my program(ksh) to execute further only if the return key is pressed. Please help. i have already tried "\n", "\r", "^M" . Thanks in advance (2 Replies)
Discussion started by: AiK
2 Replies

3. UNIX for Dummies Questions & Answers

screen blinks when escape key is pressed

hi folks, i am using sun solaris, when i press escape key in putty/netterm screen will blink for a second, plese let me know where this setting is done by my admin, what i feel is my admin must have set some control key for this so that screen will refresh each time i press escape key. please let... (1 Reply)
Discussion started by: sudheer157
1 Replies

4. Shell Programming and Scripting

how can i do some action when 'ctrl+d' is pressed

hi Gurus, please why is this happening: when i run this: #!/bin/bash declare -a name declare -a ph declare -a eid r=0; c=1; i=1; n=; echo " name phone email_id" while : do #if ; then #break; #else echo -n "field $i:"; read name ph eid; let "i++"; ... (5 Replies)
Discussion started by: tprayush
5 Replies

5. Shell Programming and Scripting

Wait given time unless key pressed

Hello everyone. I'm trying to create a script that waits a given amount of time unless a given key is pressed. I found a very useful thread here https://www.unix.com/shell-programming-scripting/59605-trap-key-press-script.html however, I cannot figure out a way of avoiding the keypress if the... (2 Replies)
Discussion started by: cue
2 Replies

6. Shell Programming and Scripting

Disable Enter key to be pressed

Hi Experts, I have a script in which I want to disable the "Enter" key press. Actually my script executes some process in background. So, till that background process is running, I don't want "Enter" key to be pressed by user. Is this can be achieved using trap command? (6 Replies)
Discussion started by: R0H0N
6 Replies

7. Shell Programming and Scripting

how can i know the pressed key is arrowup?

Hi all, I need to know how to test a pressed key is arrowup or arrowdown and etc.. I found that the "echo" won't print anything if i enter the arrowup in the below code: read echo "you pressed $REPLY" Then i find a way to achieve my goal. 1 #! /bin/bash 2 3 ARROWUP='\;then... (4 Replies)
Discussion started by: homeboy
4 Replies

8. Shell Programming and Scripting

Get Rid ^C when pressed Ctrl-C

How do i get rid of the ^C when i pressed Ctrl-C? (7 Replies)
Discussion started by: vietrice
7 Replies

9. Ubuntu

Pressed/Net Install 12.04 LTS

So I mounted a 12.04 LTS ISO, exported it via apache. Goy my netinstall files in place. Pointed Foreman to my install media the Preseed config files run. Life is good. Server comes up, I run apt-get update and blam: : Failed to fetch... (0 Replies)
Discussion started by: general_lee
0 Replies

10. Shell Programming and Scripting

Detect OS

whats the equivalent of detect OS in perl with an if then ? platform='uname' if ]; then alias ls='ls --color=auto' elif ]; then alias ls='ls -G' fi In perl I see perl -Mstrict -MEnglish -E 'say $OSNAME' or print "$^O" Please use CODE tags as required by... (1 Reply)
Discussion started by: nixguynj
1 Replies
glutSpecialUpFunc(3GLUT)					       GLUT						  glutSpecialUpFunc(3GLUT)

NAME
glutSpecialUpFunc - sets the special keyboard up (key release) callback for the current window. SYNTAX
#include <GLUT/glut.h> void glutSpecialUpFunc(void (*func)(int key, int x, int y)); ARGUMENTS
func The new special callback function. DESCRIPTION
glutSpecialUpFunc sets the special keyboard up (key release) callback for the current window. The special keyboard up callback is triggered when keyboard function or directional keys are released. The key callback parameter is a GLUT_KEY_* constant for the special key pressed. The x and y callback parameters indicate the mouse in window relative coordinates when the key was pressed. When a new window is created, no special up callback is initially registered and special key releases in the window are ignored. Passing NULL to glutSpecialUpFunc dis- ables the generation of special up callbacks. During a special up callback, glutGetModifiers may be called to determine the state of modifier keys when the key release generating the callback occurred. To avoid the reporting of key release/press pairs due to auto repeat, use glutIgnoreKeyRepeat to ignore auto repeated keystrokes. An implementation should do its best to provide ways to generate all the GLUT_KEY_* special keys. The available GLUT_KEY_* values are: GLUT_KEY_F1 F1 function key. GLUT_KEY_F2 F2 function key. GLUT_KEY_F3 F3 function key. GLUT_KEY_F4 F4 function key. GLUT_KEY_F5 F5 function key. GLUT_KEY_F6 F6 function key. GLUT_KEY_F7 F7 function key. GLUT_KEY_F8 F8 function key. GLUT_KEY_F9 F9 function key. GLUT_KEY_F10 F10 function key. GLUT_KEY_F11 F11 function key. GLUT_KEY_F12 F12 function key. GLUT_KEY_LEFT Left directional key. GLUT_KEY_UP Up directional key. GLUT_KEY_RIGHT Right directional key. GLUT_KEY_DOWN Down directional key. GLUT_KEY_PAGE_UP Page up directional key. GLUT_KEY_PAGE_DOWN Page down directional key. GLUT_KEY_HOME Home directional key. GLUT_KEY_END End directional key. GLUT_KEY_INSERT Inset directional key. Note that the escape, backspace, and delete keys are generated as an ASCII character. SEE ALSO
glutSpecialFunc, glutKeyboardFunc, glutKeyboardUpFunc, glutMouseFunc, glutSpaceballButtonFunc, glutButtonBoxFunc, glutTabletButtonFunc, glutGetModifiers, glutIgnoreKeyRepeat AUTHOR
Mark J. Kilgard (mjk@nvidia.com) GLUT
3.7 glutSpecialUpFunc(3GLUT)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy