Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Sep 1997 14:23:46 +0000 (GMT)
From:      Paulo Cesar Pereira de Andrade <paulo@netpar.com.br>
To:        Jon Hamilton <hamilton@pobox.com>
Cc:        Terry Lambert <tlambert@primenet.com>, hackers@FreeBSD.ORG
Subject:   Re: Timeout for sh(1) 'read' ?? 
Message-ID:  <Pine.BSF.3.96.970926140817.8612A-100000@canario.fiscodata>
In-Reply-To: <199709261259.FAA03276@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 26 Sep 1997, Jon Hamilton wrote:

> In message <199709261159.EAA20125@usr09.primenet.com>, Terry Lambert writes:
> } > 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.
> } > 
> } > I'd like to do this just using sh, and I'm not too fussed about how 
> } > hairy it is.  Any ideas?
> } > 
> } > (If sh has to be modified to achieve this, would it be a useful thing 
> } > to bring back?)
> } 
> } Write a "timedread" program that returns "TIMEOUT" or "USERDATA xxxxx"
> } and do "timedread | read x" and look at the front of x?  8-) 8-).
> 
> Which will of course execute in a subshell because of the pipe and wind
> up doing you no good.  
> 
> You can do this kind of thing with background processes and trap, but
> it's not what you'd call pretty, and even that isn't as straightforward
> as it might sound.

    What about
dd if=/dev/stdin of=/dev/stdout skip=0 | read x

   I have been reading this list for time enough to know that Terry loves
it.

:)

--
Paulo Cesar Pereira de Andrade	-  mailto:paulo@netpar.com.br
FreeBSD				-  http://www.freebsd.org
XFree86				-  http://www.xfree86.org





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970926140817.8612A-100000>