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: Mart Frauenlob
Subject: Re: [Help-bash] catching read error conditions
Date: Mon, 28 Jan 2013 17:43:54 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2

On 28.01.2013 17:17, Chet Ramey wrote:
On 1/28/13 11:11 AM, Mart Frauenlob wrote:
On 28.01.2013 16:59, 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.

I observed an exit status of 142 if I remember correctly.

That's 128+SIGALRM (14).

Is that consistent over bash versions 3+ ?

I put it in explicitly in bash-4.0.

Could I rely on that for catching the evidence of timeout?

I don't plan on changing that, but SIGALRM does have different values on
different systems, so it all depends on just how portable you want your
shell code to be.

So if i do like

(($? > 128)) && printf "timeout reached, or signal received\n"

will that be correct and generic enough, if I write a bash-only script?




reply via email to

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