Questions tagged «yes»

3
是的如何快速写入文件?
让我举个例子吧: $ timeout 1 yes "GNU" > file1 $ wc -l file1 11504640 file1 $ for ((sec0=`date +%S`;sec<=$(($sec0+5));sec=`date +%S`)); do echo "GNU" >> file2; done $ wc -l file2 1953 file2 在这里您可以看到该命令在一秒钟内yes写入了11504640行,而我只能1953使用bash for和在5秒内写入行echo。 正如评论中所建议的那样,有多种技巧可以使其更高效,但没有一个能与之匹敌的速度yes: $ ( while :; do echo "GNU" >> file3; done) & pid=$! ; sleep 1 ; …
58 bash  coreutils  write  yes 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.