bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"read" builtin: timeout vs. EOF


From: Stephen Gildea
Subject: "read" builtin: timeout vs. EOF
Date: Sun, 18 Dec 2011 08:45:28 -0800

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]