Implementing a Timeout During Shell Script Data Entry

Michael Morrell morrell at hpcuhb.cup.hp.com
Tue Oct 23 18:28:30 AEST 1990


/comp.unix.shell / larry at 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



More information about the Comp.unix.shell mailing list