Implementing a Timeout During Shell Script Data Entry
Bernd Felsche
bernie at DIALix.oz.au
Tue Oct 23 00:51:29 AEST 1990
The following seems to work for me:
#!/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.
--
________Bernd_Felsche__________bernie at DIALix.oz.au_____________
[ Phone: +61 9 419 2297 19 Coleman Road ]
[ TZ: UTC-8 Calista, Western Australia 6167 ]
More information about the Comp.unix.shell
mailing list