把标准输入复制到标准输出和一个或多个文件中

tee [options] file-list

 

参数

file-list 是用于接收tee输出的文件路径列表,如果file-list不存在,就创建它

 

选项

-a            追加数据给制定的文件,而不是覆盖

-i             忽略中断信号

 

示例

tee

$ tee a.txt
hello world
hello world
$ cat a.txt 
hello world

创建文件并写入数据,此处用法与cat > file一样,但除了写进数据,tee还会打印出来

ctrl+D退出

 

tee -a

$ tee -a a.txt 
this is the last time
this is the last time
$ cat a.txt 
hello world
this is the last time

追加数据到文件,并打印到标准输出,此处用法与cat >> file一样

 

 

相关文章:

  • 2021-05-28
  • 2021-10-04
  • 2022-01-10
  • 2021-06-01
  • 2021-06-11
  • 2021-12-14
  • 2022-02-28
  • 2021-07-16
猜你喜欢
  • 2021-12-19
  • 2021-07-06
  • 2021-06-27
  • 2021-07-27
  • 2021-10-12
  • 2021-06-24
  • 2021-09-17
相关资源
相似解决方案