I want to generate a sorted list with all 8-digit numbers — from 00000000 to 99999999. I typed in the shell:
f() {
while IFS="" read -r line; do
for i in {0..9}; do
echo "$line$i";
done;
done
}
echo | f | f | f | f | f | f | f | f | tee result.txt | wc -l
response is
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
99998890
Why have I got these three errors and malformed result.txt ?
I use
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Debian GNU/Linux 9.6 (stretch)
Linux kernel: 4.19.0 #2 SMP Thu Nov 1 15:31:34 EET 2018 x86_64 GNU/Linux
seq -w 0 99999999
.}
) works correctly. @GAD3Rkonsole
window. Such resizing is almost sufficient in my case, yet not necessary.| tee result.txt
, and still get the error./bin/echo
in my case) instead ofecho
builtin makes the function immune (or at least less prone) to this issue.