Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
On 29.01.2013 01:51, Dan Douglas wrote:
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:
...]
(($? > 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.
[...]
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.
Thank you for noting that special case.
So if no fd is available read returns failure (anyways?),
if TMOUT=0 and and fd is available, read will wait for input "forever",
right?
oh, are TMOUT and the -t option of read fully equal in effect?
It looks like to me, but afaics the man page does not explicitly say so.
P.S. some fun for inexperienced colleges :) (to put into startup file?):
trap 'printf "you are too lazy\n";exit' EXIT
TMOUT=1