Shell 将输出写入两个文件,覆盖第一个文件,附加到第二个文件
我想将一个脚本的输出写入两个文件。覆盖第一个文件但追加到第二个文件 我目前正在做:Shell 将输出写入两个文件,覆盖第一个文件,附加到第二个文件,shell,Shell,我想将一个脚本的输出写入两个文件。覆盖第一个文件但追加到第二个文件 我目前正在做: echo Foo Bar | tee -a one.txt | tee -a two.txt 但这会将Foo-Bar附加到这两个文件中 例如: 以前 cat one.txt #=> Bar Foo cat two.txt #=> Hello world 之后 我怎样用一个命令就能做到这一点呢?你已经很接近答案了 tee-a表示附加。没有-a表示覆盖 echo Foo Bar | tee one.
echo Foo Bar | tee -a one.txt | tee -a two.txt
但这会将Foo-Bar
附加到这两个文件中
例如:
以前
cat one.txt
#=> Bar Foo
cat two.txt
#=> Hello world
之后
我怎样用一个命令就能做到这一点呢?你已经很接近答案了
tee-a
表示附加。没有-a
表示覆盖
echo Foo Bar | tee one.txt | tee -a two.txt
你已经很接近答案了
tee-a
表示附加。没有-a
表示覆盖
echo Foo Bar | tee one.txt | tee -a two.txt
你已经很接近答案了
tee-a
表示附加。没有-a
表示覆盖
echo Foo Bar | tee one.txt | tee -a two.txt
你已经很接近答案了
tee-a
表示附加。没有-a
表示覆盖
echo Foo Bar | tee one.txt | tee -a two.txt