cat 1.txt > 2.txt #覆盖
cat 1.txt >> 2.txt #追加
ls aaa.txt 2>err #错误输出信息输入到指定文件覆盖,err为指定文件如a.txt
ls aaa.txt 2>>err #错误输出信息输入追加到指定文件,err为指定文件如a.txt
?? eof?
while ((1==1));do echo nihao >/dev/null;done #黑洞 > /dev/null
>+2> == &> 正确和错误重定向 ;也可写成: ls [12].txt 3.txt >a.txt 2>b.txt
[root@localhost tmp]# ls [12].txt 3.txt &>a.txt
[root@localhost tmp]# cat a*
ls: 无法访问b.txt: 没有那个文件或目录
1.txt
2.txt
wc -l < 1.txt #输入重定向(几乎不用) ,wc - c 统计字节数、 - l 统计行数、 - w 统计字数。
? eof?