script to process something until any key pressed?

From: ert weerr (sun1sol@yahoo.com)
Date: Thu Jun 30 2005 - 00:51:59 EDT


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
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:31:00 EDT