我需要将命令的输出重定向到两个文件,例如 file1 和 file2 file1 是一个新文件,file2 是已经存在的文件,我需要在其中附加输出 我已经尝试过了
这没有给出预期的结果:
command > file1 > file2
最佳答案
您正在寻找tee
命令。
$ echo existing >file2
$ date | tee file1 >> file2
$ cat file2
existing
Mon Mar 9 10:40:01 CET 2009
$ cat file1
Mon Mar 9 10:40:01 CET 2009
$
关于command-line - 如何将命令的输出重定向到两个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/625571/