Article View: comp.unix.shell
Article #1572Re: Implementing a Timeout During Shell Script Data Entry
From: Bernd Felsche
Date: Mon, 22 Oct 1990 14:51
Date: Mon, 22 Oct 1990 14:51
19 lines
1086 bytes
1086 bytes
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@DIALix.oz.au_____________ [ Phone: +61 9 419 2297 19 Coleman Road ] [ TZ: UTC-8 Calista, Western Australia 6167 ]
Technical Details
Message-ID:
<592@DIALix.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!munnari.oz.au!uniwa!DIALix!bernieReferences:
<4128@kitty.UUCP>nSender: Bernd FelscheShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!munnari.oz.au!uniwa!DIALix!bernie From: bernie@DIALix.oz.au (Bernd Felsche) Newsgroups: comp.unix.shell Subject: Re: Implementing a Timeout During Shell Script Data Entry Summary: Use kill and signals Keywords: timeout, data entry, child process, simplest method Message-ID: <592@DIALix.oz.au> Date: 22 Oct 90 14:51:29 GMT References: <4128@kitty.UUCP>nSender: Bernd Felsche Reply-To: bernie@DIALix.oz.au (Bernd Felsche) Organization: DIALix Services, Perth, Western Australia Lines: 19