From owner-freebsd-hackers Sat Sep 27 23:50:42 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id XAA12065 for hackers-outgoing; Sat, 27 Sep 1997 23:50:42 -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 XAA12060 for ; Sat, 27 Sep 1997 23:50:38 -0700 (PDT) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id IAA00101 for hackers@FreeBSD.ORG; Sun, 28 Sep 1997 08:50:37 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id IAA00579; Sun, 28 Sep 1997 08:36:20 +0200 (MET DST) Message-ID: <19970928083619.EN11505@uriah.heep.sax.de> Date: Sun, 28 Sep 1997 08:36:19 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG Subject: Re: Timeout for sh(1) 'read' ?? References: <19970928073430.CC50911@uriah.heep.sax.de> <199709280603.PAA04849@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: <199709280603.PAA04849@word.smith.net.au>; from Mike Smith on Sep 28, 1997 15:33:13 +0930 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Mike Smith wrote: > > $foo=${foo:-default} > > Hmm. Actually, you would get the desired behaviour with > > val=${default} Well, sure. I didn't see this. :) You need to assign a value in the first place anyway. > read -t 5 val > > because read won't have had a chance to modify 'val' if it does time > out. So should read return an error if it times out? What does ksh do? It does: j@uriah 66% ksh93 $ read -t 5 foo # and just wait $ echo $? 1 $ read -t 5 foo babble $ echo $? 0 $ exit -- 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. ;-)