Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Sep 1997 07:34:30 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.ORG
Subject:   Re: Timeout for sh(1) 'read' ??
Message-ID:  <19970928073430.CC50911@uriah.heep.sax.de>
In-Reply-To: <199709280223.LAA03408@word.smith.net.au>; from Mike Smith on Sep 28, 1997 11:53:06 %2B0930
References:  <19970927164250.YQ59393@uriah.heep.sax.de> <199709280223.LAA03408@word.smith.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
As Mike Smith wrote:

> > 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.
> 
> OK.  To be added are :
> 
>  -t <timeout>
>  -d <default>
> 
> Such that if no input is received after <timeout> seconds, <default> 
> will be returned, or the empty string if <default> is not supplied.

Oh no!

Please don't introduce options with a different meaning than in ksh.
ksh93 uses -d delim for an alternate line delimiter character than
newline, and does not provide for a default value.

I see a need for the -t timeout parameter, since it's basically not
possible to catch it otherwise without going through major hoops (due
to shell-internal variable assignments that are required, so you can't
e.g. easily employ a subshell).  However, assigning default values is
something that is reasonably covered by things like:

	$foo=${foo:-default}

(Implementing -r)

> I could do with some guidance from people likely to be bitten by this; 
> is such a major change in the name of POSIX worthwhile?

Well, it's hard to proclaim Posix conformance otherwise.  I thought
that was one of our goals.  I doubt anybody would notice the change...
(But if you wanna know my personal opinion: the Posix way is stupid.
They should at least have made it the other way round.  However, the
LNEXT character is IMHO not standardized by Posix, so this explains
the backslash mess they are proposing.)

-- 
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. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970928073430.CC50911>