tee
前幾天電腦壞了。。喘沿。尷尬
tee - read from standard input and write to standard output and files
從標(biāo)準(zhǔn)輸入讀取信息奥帘,并且輸出到標(biāo)準(zhǔn)輸出和文件
cc@MyLinux:~/test$ who |tee a.file
cc tty1 2017-03-19 07:01
cc pts/0 2017-03-19 07:02 (192.168.254.1)
cc@MyLinux:~/test$ cat a.file
cc tty1 2017-03-19 07:01
cc pts/0 2017-03-19 07:02 (192.168.254.1)
- -a 追加,不清空原來文件中的信息
cc@MyLinux:~/test$ pwd |tee -a a.file
/home/cc/test
cc@MyLinux:~/test$ cat a.file
cc tty1 2017-03-19 07:01
cc pts/0 2017-03-19 07:02 (192.168.254.1)
/home/cc/test
cc@MyLinux:~/test$ who |tee b.file
- 用tee生成文件
cc@MyLinux:~/test$ tee test.c
#include <stdio.h>
#include <stdio.h>
int main()
int main()
{
{
printf("hello tee\n");
printf("hello tee?");
return 0;
return 0;
}
}
^C
cc@MyLinux:~/test$
cc@MyLinux:~/test$ cat test.c
#include <stdio.h>
int main()
{
printf("hello tee?");
return 0;
}