假设你运行下面的命令:
ssh $host1 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' > /tmp/output ssh $host2 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output ssh $host3 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output
然后输出将如下所示:
Hello from host1 Hello from host2 Hello from host3 Hello from host1 ...
但如果我把它改成
ssh $host1 'while [ 1 ]; do sleep 1; cat /some/large/file1.txt; done' > /tmp/output ssh $host2 'while [ 1 ]; do sleep 1; cat /some/large/file2.txt; done' >> /tmp/output ssh $host3 'while [ 1 ]; do sleep 1; cat /some/large/file3.txt; done' >> /tmp/output
所以从每个主机标准输出将不适合到一个单一的缓冲区? 将文件[1-3]。txt文件,而不是顺序的数据的完整性,在这种情况下被保持? 是否有一些其他的文件的文件片段在这样的一些其他文件的中间滑落的可能性?
[file1_fragment1] [file2_fragment1] [file1_fragment2] [file1_fragment3] [file3_fragment1] ...