Strange question

Good day.

I whant to put in a "readkey" function into my script. My script will be running in "real time". Basicaly I whant to add a eg. "Press X to exit" statement into my script. More or less like the read command, but I don't whant it to wait for the user to press enter. eg. Readkey. If no key is pressed then continuiu with the script, if a key is pressed, well use it or incorporate it in the main script.

Is there any tipe of thing like this, or am I going overboard with my scripting a bit?

And while U are reading this. Is there a place where I can post demo's of my scripts so that others can lean from them aswell.

Thanks.

if u're using bash u can use

read -t 60 readkey

60 is in seconds

Thanks will give it a try.

Appreciate it.

You can post your solution so that others can learn.

From the archives... here is another possible solution.. It could be more than what you asked for...

making a .sh wait for user input

Vino

Cool question and a cool answer. I didn't know of this. Thanks to both of you. :slight_smile:

function getch {
stty raw
typeset x
x=`dd bs=1 count=1`
stty -raw
echo $x
}