🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1598

Re: Implementing a Timeout During Shell Script Data Entry

#1598
From: Michael Morrell
Date: Tue, 23 Oct 1990 08:28
19 lines
1058 bytes
/comp.unix.shell / larry@kitty.UUCP (Larry Lippman) /  9:35 pm  Oct 20, 1990/

	I would be interested in seeing any suggestions for implementing
a timeout for lack of response to a "read" statement contained in a shell
script running under Bourne shell.
----------

You might try using the probably undocumented timeout feature of line(1).
I'm not sure which versions of Un*x have this "feature", but you could check.
It's used as follows:

  echo "Prompt\c"      [ or echo -n "Prompt" ]
  reply=`line -t 10`

The line command will return after 10 seconds if no input has been detected.

Hope this helps,

   Michael
Technical Details
Message-ID: <38020001@hpcuhb.cup.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!mcdchg!laidbak!ism.isc.com!uunet!know!sdd.hp.com!hplabs!hpda!hpcuhb!morrell
References: <4128@kitty.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!mcdchg!laidbak!ism.isc.com!uunet!know!sdd.hp.com!hplabs!hpda!hpcuhb!morrell
From: morrell@hpcuhb.cup.hp.com (Michael Morrell)
Newsgroups: comp.unix.shell
Subject: Re: Implementing a Timeout During Shell Script Data Entry
Message-ID: <38020001@hpcuhb.cup.hp.com>
Date: 23 Oct 90 08:28:30 GMT
References: <4128@kitty.UUCP>
Organization: Hewlett Packard, Cupertino
Lines: 19