Skip site navigation (1)Skip section navigation (2)
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' ??
Message-ID:  <19970927163558.WP09379@uriah.heep.sax.de>
In-Reply-To: <199709260748.RAA00456@word.smith.net.au>; from Mike Smith on Sep 26, 1997 17:18:45 %2B0930
References:  <199709260748.RAA00456@word.smith.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)



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