help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] read


From: Chet Ramey
Subject: Re: [Help-bash] read
Date: Sun, 18 Mar 2012 13:08:07 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 3/17/12 11:47 PM, Bill Gradwohl wrote:
> address@hidden ~# TMOUT=1; read; echo $?; sleep 10
> 142
> 
> 
> Can I count on that return code for a timeout?
> 
> What are the other read return codes?

The bash documentation guarantees that the return status will be greater
than 128 if `read' times out.  Right now, that's 128+SIGALRM, but that's
not a guarantee (and SIGALRM doesn't have the same value everywhere).
Other errors, listed in the man page, will cause the exit status to be
greater than 0.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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