help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] catching read error conditions


From: Steven W. Orr
Subject: Re: [Help-bash] catching read error conditions
Date: Mon, 28 Jan 2013 11:12:47 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2

On 1/28/2013 10:59 AM, Chet Ramey wrote:
On 1/28/13 8:32 AM, Greg Wooledge wrote:

Well, any of the ways of testing the exit status should suffice.
Also note that you can't distinguish a failure-due-to-timeout from
other kinds of failures.

Not quite true.  The manual says:

"The exit status is greater than 128 if the timeout is exceeded."

That does narrow the error space.

Chet


Which works out very nicely, in that (on my Fedora system) I get an exit status of 142. And 142 - 128 is 14. And 14 happens to be the value of SIGALRM. Why is this nice? Because, the exit status of a program that exits is less than 128 and the exit status of a program that signals out should be 128 + the signal that was not caught (as described in The Fine Manual). This also applies to simple builtin commands.


--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

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