00000000から99999999までの8桁の数字をすべて含むソートされたリストを作成したいと思います。私はシェルに次のように入力しました:
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
答えは次のとおりです
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
99998890
これらの3つのエラーと間違ったresult.txtが表示されるのはなぜですか?
私は使う
GNU bash、バージョン 4.4.12(1)-リリース(x86_64-pc-linux-gnu)
Debian GNU/Linux 9.6(拡張)
Linuxカーネル: 4.19.0 #2 SMP Thu Nov 1 15:31:34 EET 2018 x86_64 GNU/Linux
ベストアンサー1
write error: Interrupted system call
スクリプトの実行中にコンソールウィンドウのサイズを変更すると、特定のエラーが生成されます。
何かを作る:
trap '' SIGWINCH
それを避けます。
参考にしてください
seq 99999999 >result.txt; wc -l <result.txt
より速く、このSIGWINCH
問題を回避できます。