Disable Enter key to be pressed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Disable Enter key to be pressed
# 1  
Old 12-06-2010
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?
R0H0N
# 2  
Old 12-06-2010
Um, I am missing something. The whole point of running in the background is so that the foreground can do something else. Or so you can run several processes at one time. If you do not want the user to touch the keyboard, consider running the background process in the foreground, maybe display something showing the progress of the code.

Otherwise can you explain a little more...
# 3  
Old 12-06-2010
my problem is, I am going to set the cursor using 'tput cup' command after this background process completes. so, my problem is the cursor moves to the next line if enter key have been pressed during this period. I want to protect that thing only. otherwise my program run very smoothly.
R0H0N
# 4  
Old 12-06-2010
This suggestion is not a great idea but it will work.
In the background code - issue a
Code:
#!/bin/bash
kill -STOP $PPID
..... run your code here
kill -CONT $PPID

# 5  
Old 12-06-2010
What shell scripting language are you using ?
# 6  
Old 12-06-2010
You can turn off the enter key for a foreground process with
Code:
#!/bin/bash
stty igncr
... your code here
stty -igncr

This will prevent cursor movement caused by the enter key but does not work when the process is in background (but the user can't do anything anyway while your code is running so why not run in foreground?).
# 7  
Old 12-06-2010
cero - that was the point I tried to make earlier. My idea was to cut off all input, not just the return key.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simulate enter key

I have a popup window that appears on every boot up. I would like to have it dismissed automatically each time instead of having to hit the enter key. I thought I could write a script that would execute on startup. I tried this xdotool key return andy@7_~/Downloads$ xdotool key ... (7 Replies)
Discussion started by: drew77
7 Replies

2. Red Hat

Enter Bios and disable onboard NICS?

Hi, I have to get into BIOS and disable onbaord NICS for an IBM server, can someone please help me out. I tried hitting F1 when reboot to get into BIOS, but it seems like a setup screen and I dont see any option to disable NICS? Thanks Sam (0 Replies)
Discussion started by: sam4919
0 Replies

3. 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

4. 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

5. Shell Programming and Scripting

How to disable Enable/Disable Tab Key

Hi All, I have bash script, so what is sintax script in bash for Enable and Disable Tab Key. Thanks for your help.:( Thanks, Rico (1 Reply)
Discussion started by: carnegiex
1 Replies

6. Shell Programming and Scripting

enter key solaris

Hi, When I run script on Sun Solaris (sassetup), it prompts to "Press Enter To Continue". Now I want to automate this, ie put sassetup in a script file. So, when I run this file, it should be executed automatically without waiting for anyone to press Enter Key. I have tried the following... (1 Reply)
Discussion started by: sajjunaqvi
1 Replies

7. 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

8. 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

9. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

10. 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
Login or Register to Ask a Question