More to the essence:

    $ read -t0 </dev/null ; echo $?
    0
    $

Presumably every implementation is ultimately calling select(), and so
what is really being tested is "reading would not block".  But as you
can see "would not block" is equivalent to "an input byte is available
or the fd is at EOF".  Since the implementation is unlikely to change
(and it would probably break deployed code), we should update the
documentation to

    If timeout is 0, read returns immediately, without trying to read
    any data. The exit status is 0 if reading the specified file
    descriptor would not block (i.e., input is available or it has EOF),
    non-zero otherwise."

Dale

Reply via email to