From owner-freebsd-hackers Sat Sep 27 07:53:03 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id HAA25812 for hackers-outgoing; Sat, 27 Sep 1997 07:53:03 -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 HAA25790 for ; Sat, 27 Sep 1997 07:52:53 -0700 (PDT) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id QAA22410 for hackers@FreeBSD.ORG; Sat, 27 Sep 1997 16:52:52 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id QAA17060; Sat, 27 Sep 1997 16:42:50 +0200 (MET DST) Message-ID: <19970927164250.YQ59393@uriah.heep.sax.de> Date: Sat, 27 Sep 1997 16:42:50 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG Subject: Re: Timeout for sh(1) 'read' ?? References: <199709260748.RAA00456@word.smith.net.au> <19970927163558.WP09379@uriah.heep.sax.de> 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: <19970927163558.WP09379@uriah.heep.sax.de>; from J Wunsch on Sep 27, 1997 16:35:58 +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk I wrote: > 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. NB: pdksh only implements the last of the three features (at least my version)... > read [ -Aprs ] [ -d delim] [ -t timeout] [ -u > unit] [ vname?prompt ] [ vname ... ] ...nor does it support -t timeout. Adding -t timeout seems to be the best way to me. ${TMOUT} is just confusing given the multitude of things it's going to do. Btw., if you're going to do this, please do also implement -r. It seems to be mandated by Posix.2: By default, unless the -r option is specified, backslash (\) shall act as an escape character, as described in 3.2.1. 3.2.1 Escape Character (Backslash) A backslash that is not quoted shall preserve the literal value of the following character, with the exception of a . If a follows the backslash, the shell shall interpret this as line continuation. The backslash and shall be removed before splitting the input into tokens. (That is, the backslash should act like ^V.) -- 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. ;-)