[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read -t
Re: read -t
Sun, 04 Jan 2015 11:21:50 -0500
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
On 1/4/15 12:45 AM, isabella parakiss wrote:
> I'm trying to use read -t in an interactive shell
> read -t 3 *press random keys*
> Everything i press is now part of the next command in the prompt.
> It only happens when the delimiter is a \n.
> Is this intended? What's the point?
It's difficult for me to tell what the question is here. You've asked
for bash to read as much input as it can until it reads a newline, with
the read aborted if you don't press a newline within three seconds. Since
you don't press newline, read(2) doesn't return anything and whatever
you've typed is left in the input buffer as typeahead for readline. When
readline is called, it is able to read all of the typeahead and use it as
part of the next input line.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
- read -t, isabella parakiss, 2015/01/04
- Re: read -t,
Chet Ramey <=