On 12/18/11 11:45 AM, Stephen Gildea wrote: > 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.
Sure. It seems reasonable that if the read builtin `exits' due to a signal, it should set the exit status the same way as any other command that exits that way (128+SIGALRM). The documentation already says "the exit status is greater than 128 if the timeout is exceeded" in a couple of places. Does it really need to be in the help text, which is just a short reminder reference, as well? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/