bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read -t 0 fails to detect input.


From: Robert Elz
Subject: Re: read -t 0 fails to detect input.
Date: Thu, 19 Dec 2019 08:39:28 +0700

    Date:        Wed, 18 Dec 2019 19:40:45 -0400
    From:        Bize Ma <address@hidden>
    Message-ID:  <address@hidden>

  | A little delay seems to get it working:
  |
  | $ echo value | { read -t 0 var; } ; echo $?
  | 0

It might, but that is adding no significant delay, and the
results are unpredictable.

jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0
jinx$ echo value | { read -t 0 var; } ; echo $?
1
jinx$ echo value | { read -t 0 var; } ; echo $?
0

It is all just a race condition - there's nothing specifying which
side of the pipe starts running first.

kre




reply via email to

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