Implementing a Timeout During Shell Script Data Entry

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Wed Oct 24 10:54:45 AEST 1990


In article <592 at DIALix.oz.au> bernie at DIALix.oz.au (Bernd Felsche) writes:

| #!/bin/sh  (or korny, if you have it)
| 
|   delay=6
|   trap 'trap 14' 14
|   echo "What is your Quest? \c"
|   (sleep $delay; kill -14 $$ 2>/dev/null)&
|   read YourQuest
|   kill $! 2>/dev/null
|   [ ! -z "$YourQuest" ] && echo "Bah. Humbug. Not interested in $YourQuest" \
|   			|| echo "You must be interested in something!"
| 
| Hope that does the trick.

  Works here under sh, not under ksh. No idea.
-- 
bill davidsen - davidsen at sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.shell mailing list