[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read -t0 doesn't pick up waiting characters
From: |
Chet Ramey |
Subject: |
Re: read -t0 doesn't pick up waiting characters |
Date: |
Mon, 10 Aug 2009 13:23:17 -0400 |
User-agent: |
Thunderbird 2.0.0.22 (Macintosh/20090605) |
Chris F.A. Johnson wrote:
> (Using 4.0.28(2)-release on Linux and 4.0.24(0)-release on FreeBSD.)
>
> Given this script:
>
> delay=0
> read -sn1 v
> read -sn1 -t "$delay" w
> read -sn1 -t "$delay" x
>
> if I press the up arrow, which generates '\e[A', I would have
> expected $w to contain '[' and $x to contain 'A'. However, they
> are empty. They do pick up the characters if I change delay to
> .0001.
read -t0 only polls and returns success or failure depending on whether
or not input is available on the specified file descriptor.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/