script to process something until any key pressed?

2007-12-25 5:07:00

Guys,

I'm working on a simple ksh script that has to
process something until the user pressed a
key.

Unfortunately I can't figure out how to feed this with
ksh.
Here's what I have so far...

#!/bin/ksh

function check_key
{
if [[ -z "$MESSAGE" && "$MESSAGE" = "q" ]]
then
return 1
else
exit
fi
}

until check_key
do
echo "XXXX"
sleep 2
read MESSAGE
done

The problem is that the script waits for the user
input after the first loop instead of running
indefinitely until someone presses a key.
Is it achiavable at all in a script?

Thanks in advance!

Regards,

John
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Comments

Got something to say?

You must be logged in to post a comment.