[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
terminate read after not receiving additional input for some time
From: |
Peng Yu |
Subject: |
terminate read after not receiving additional input for some time |
Date: |
Wed, 31 Mar 2021 15:24:56 -0500 |
Hi,
I want to terminate read after not receiving additional input for some
time. So for the following example, if I used the timeout of 2 in this
sense, I should get "abcd" instead "ab". But `read` does not have a
way to set this kind of timeout. Is there any other way to achieve
this with bash?
$ read -t 2 -r x < <(echo -n a; sleep 1; echo -n b; sleep 1; echo -n
c; sleep 1; echo -n d)
$ declare -p x
declare -- x="ab"
--
Regards,
Peng
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- terminate read after not receiving additional input for some time,
Peng Yu <=