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?

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

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.

This suggestion is not a great idea but it will work.
In the background code - issue a

#!/bin/bash
kill -STOP $PPID
..... run your code here
kill -CONT $PPID

What shell scripting language are you using ?

You can turn off the enter key for a foreground process with

#!/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?).

cero - that was the point I tried to make earlier. My idea was to cut off all input, not just the return key.