Denys Vlasenko | eae1268 | 2017-07-20 16:09:31 +0200 | [diff] [blame] | 1 | # ><[0] |
| 2 | echo Ok | { sleep 0.1; read -t 0 reply; echo ">$reply<[$?]"; } |
| 3 | |
| 4 | # This would not be deterministic: returns 0 "data exists" if EOF is seen |
| 5 | # (true terminated) - because EOF is considered to be data (read will not block), |
| 6 | # else returns 1 "no data". |
| 7 | ## ><[????] |
| 8 | #true | { read -t 0 reply; echo ">$reply<[$?]"; } |
| 9 | |
| 10 | # ><[0] |
| 11 | true | { sleep 0.1; read -t 0 reply; echo ">$reply<[$?]"; } |
| 12 | |
| 13 | # ><[1] |
| 14 | sleep 0.2 | { read -p IGNORED_PROMPT -t 0 reply; echo ">$reply<[$?]"; } |