user input timeouts?

Kevin D. Clark kclark at CetaceanNetworks.com
Tue Feb 10 14:43:58 EST 2004


Bob Keyes writes:

> I am working on a 2 floppy linux disttribution, and I want it to be able
> to make some intelligent decisions when it is operating unattended but
> still allow a user at the console to interrupt some startup procedures.
> 
> So, I want basically this: User is given a period of time (8 seconds or
> so) to either hit Y to to continue or N to abort, and if they fail to take
> action within that time, a default action will occur.
> 
> I am doing this on a small system, like I said, and have busybox and ash
> at my disposal. I could probably write a C program to do it but would
> rather not. Anyone have any ideas?

Does this work with ash?

    if read -p "Initiate self-destruct sequence? " -t 8 KEY ; then
      :
    else
       KEY=n
    fi

Obviously, there are more complicated ways to do this as well.

Regards,

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc




More information about the Discuss mailing list