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: Dan Douglas
Subject: Re: [Help-bash] catching read error conditions
Date: Mon, 28 Jan 2013 18:51:52 -0600
User-agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )

On Monday, January 28, 2013 06:27:24 PM Mart Frauenlob wrote:
> On 28.01.2013 17:48, Chet Ramey wrote:
> > On 1/28/13 11:43 AM, Mart Frauenlob wrote:
> >
> >> 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?
> >
> > Yes, that would work.
> 
> 
> Thank you very much for your kind assistance.
> 
> Best regards
> 
> Mart
> 

Also, for Bash's read:

  /* `read -t 0 var' tests whether input is available with select/FIONREAD,
     and fails if those are unavailable */
  if (have_timeout && tmsec == 0 && tmusec == 0)
#if 0
    return (EXECUTION_FAILURE);
#else
    return (input_avail (fd) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
#endif

...

Don't know whether that's worth testing or improves reliability in your case.
-- 
Dan Douglas



reply via email to

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