[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [doc] read -t and sockets, devices...
From: |
Stephane Chazelas |
Subject: |
Re: [doc] read -t and sockets, devices... |
Date: |
Sun, 15 Jun 2008 10:38:23 +0100 |
User-agent: |
Mutt/1.5.16 (2007-09-19) |
On Sat, Jun 14, 2008 at 10:15:06PM -0400, Chet Ramey wrote:
> Stephane Chazelas wrote:
>
>> What about a different $? (like 2 for timeout)?
>
> That's reasonable. I'm thinking 128+SIGALRM.
[...]
That makes sense, but it's a bit of a pain to handle.
read -t 10 var; ret=$?
case $ret in
(0) OK;;
(1) EOF;;
(*) if [ "$ret" -gt 128 ] && [ "$(kill -l "$ret")" = ALRM ]
then TIMEOUT
else UNKNOWN
fi
;;
esac
--
Stéphane