[hupeng@hupeng-vm shell]$
ls
test/ |
tee
pwd
.
sh
[hupeng@hupeng
-vm shell]$
ls
test/ |
tee
-
#将标准输入的内容再拷贝一份 输出到屏幕
pwd
.
sh
pwd
.
sh
[hupeng@hupeng
-vm shell]$
ls
test/ |
tee
- -
#将标准输入的内容再拷贝2份 输出到屏幕
pwd
.
sh
pwd
.
sh
pwd
.
sh
[hupeng@hupeng
-vm shell]$
ls
test/ |
tee
1
.txt
2
.txt #将标准输入的内容拷贝到1.txt 和2.txt,同时输出到屏幕
pwd
.
sh
[hupeng@hupeng
-vm shell]$
cat
1
.txt
pwd
.
sh
[hupeng@hupeng
-vm shell]$
cat
2
.txt
pwd
.
sh
[hupeng@hupeng
-vm shell]$
ls
test/ |
tee
1
.txt
2
.txt #默认是w的方式写入文件
pwd
.
sh
[hupeng@hupeng
-vm shell]$
cat
1
.txt
pwd
.
sh
[hupeng@hupeng
-vm shell]$
cat
2
.txt
pwd
.
sh
[hupeng@hupeng
-vm shell]$
ls
test/ |
tee
-a
1
.txt
2
.txt #-
a 指定以append的方式写入文件
pwd
.
sh
[hupeng@hupeng
-vm shell]$
cat
1
.txt
pwd
.
sh
pwd
.
sh
[hupeng@hupeng
-vm shell]$
cat
2
.txt
pwd
.
sh
pwd
.
sh
[hupeng@hupeng-vm shell]$echo a1 > a1
[hupeng@hupeng-vm shell]$echo a2 > a2
[hupeng@hupeng-vm shell]$echo a3 > a3
[hupeng@hupeng-vm shell]$cat a*
[hupeng@hupeng-vm shell]$chmod 000 a1
[hupeng@hupeng-vm shell]$cat a*
cat: a1: Permission denied
[hupeng@hupeng-vm shell]$cat a* 2>/dev/null #将stderr输出到空洞文件中
[hupeng@hupeng-vm shell]$#管道将一端的标准输出作为另一端的输入
[hupeng@hupeng-vm shell]$cat a* | tee out.txt
cat: a1: Permission denied
[hupeng@hupeng-vm shell]$cat out.txt
[hupeng@hupeng-vm shell]$cat a* 2>&1 | tee out.txt #将stderr从定向到stdout
cat: a1: Permission denied
[hupeng@hupeng-vm shell]$cat out.txt
cat: a1: Permission denied
[hupeng@hupeng-vm shell]$cat a* | tee out.txt | cat -n # -n 表示显示行号
cat: a1: Permission denied
[hupeng@hupeng-vm shell]$cat a* 2>&1 | tee out.txt | cat -n
1 cat: a1: Permission denied