On 10/24/21 12:22 PM, Martin Schulte wrote:
Before reading the source I would never have thought that read sets variables
although it returns FAILURE.
Think of them as orthogonal conditions. `read' reads until a newline, or
EOF or other error condition (ignoring timeouts or reading N characters for
a minute), storing the characters it reads into the variable(s).
The variable(s) continue(s) to hold the characters read. `read' returns a
status dependent on the status of the last read(2). If it gets EOF (or
error), the return status is > 0, but the characters read are not lost.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/