From owner-freebsd-hackers Sat Sep 27 07:52:13 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id HAA25700 for hackers-outgoing; Sat, 27 Sep 1997 07:52:13 -0700 (PDT) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id HAA25671 for ; Sat, 27 Sep 1997 07:51:56 -0700 (PDT) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id QAA22406; Sat, 27 Sep 1997 16:51:47 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id QAA17020; Sat, 27 Sep 1997 16:35:58 +0200 (MET DST) Message-ID: <19970927163558.WP09379@uriah.heep.sax.de> Date: Sat, 27 Sep 1997 16:35:58 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG Cc: mike@smith.net.au (Mike Smith) Subject: Re: Timeout for sh(1) 'read' ?? References: <199709260748.RAA00456@word.smith.net.au> X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199709260748.RAA00456@word.smith.net.au>; from Mike Smith on Sep 26, 1997 17:18:45 +0930 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Mike Smith wrote: > Hiho folks, a question for the sh(1) studs amongst you : > > - I want to prompt for input using 'read', and have the read return in > some fashion after a timeout. A quick search for the word `timeout' in the ksh93 man page unveils: TMOUT If set to a value greater than zero, TMOUT will be the default timeout value for the read built-in command. The select compound command terminates after TMOUT seconds when input is from a terminal. Otherwise, the shell will terminate if a line is not entered within the prescribed number of sec- onds while reading from a terminal. (Note that the shell can be compiled with a maxi- mum bound for this value which cannot be exceeded.) and: read [ -Aprs ] [ -d delim] [ -t timeout] [ -u unit] [ vname?prompt ] [ vname ... ] The shell input mechanism. One line is read and is broken up into fields using the characters in IFS as separators. [...] Posix doesn't seem to have any opinion for this, so it looks like just creeping featurism on ksh's side. (Posix only mentions option -r.) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)