将内容输出到两个不同的文件

Raj*_*eev 2 linux shell

如何将ls/tmp命令重定向到多个文件

即,输出需要在ls/tmp> a.txt和b.txt上

Dar*_*ust 6

用途tee:

# This way you will see the output.
ls /tmp | tee file1.txt file2.txt

# With this line you won't.
ls /tmp | tee file1.txt file2.txt >/dev/null
Run Code Online (Sandbox Code Playgroud)