Debian Codegraph @

memo/D1302/D1302.read-timeout-bash4.1.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # Bash 4.1 では read -t timeout でタイムアウトした時
4 # 読み取り済みの内容が失われてしまう。
5
6 printf '%s\n' {0..10000} | {
7 read -r -d "" -t 0.01 line
8 echo "$?:[$line]"
9 read -d "" line
10 echo "(${line::10}...#${#line})"
11 }