使用tee命令不打印到shell的正确方法

时间:2021-11-15 01:03:55

I would like to use tee to append to multiple files, however, I don't need it to print to my shell, just the files. Outputting to /dev/null works great, as the command still appends to the files, and doesn't print to the shell:

我想使用tee附加到多个文件,但是,我不需要它打印到我的shell中,只需要文件。输出到/dev/null效果很好,因为命令仍然附加到文件中,并且不会打印到shell中:

echo test | tee -a file1 file2 file3 &>/dev/null

I was just wondering if this is the proper way to do it, as tee --help doesn't seem to have a parameter to not print to shell:

我只是想知道这是否是正确的方法,作为tee -help似乎没有一个参数不打印到shell:

  -a, --append              append to the given FILEs, do not overwrite
  -i, --ignore-interrupts   ignore interrupt signals
  -p                        diagnose errors writing to non pipes
      --output-error[=MODE]   set behavior on write error.  See MODE below
      --help     display this help and exit
      --version  output version information and exit

I'm pretty sure this is the right way to do it, I guess I would just like some confirmation.

我很确定这是正确的方法,我想我只是想确认一下。

1 个解决方案

#1


3  

Well okay then...

那么好吧…

... | tee -a file1 file2 >> file3

#1


3  

Well okay then...

那么好吧…

... | tee -a file1 file2 >> file3