The "read" built-in documentation says,
Exit Status:
The return code is zero, unless end-of-file is encountered, read times out,
or an invalid file descriptor is supplied as the argument to -u.
I would like to be able to distinguish the no-data conditions. In
particular I want to know whether I got a timeout or an end-of-file,
but as you can see, Bash is not documented to behave differently in
these two cases.
As it happens, in Bash 4.2, "read" exits with status 1 on EOF and
SIGALRM on timeout. This is just what I want. Can I count on this
behavior? If so, please commit to it with documentation.
< Stephen