标准输入(stdin):代码为0 , <
标准输出 (stdout) :代码为1, >、>> 、1>、1>>
标准错误输出 (stderr)代码为2, 2> 、2>>
常见例子
ls -l >/tmp/123 2>&1
ls -l >/tmp/123 2>/tmp/list
ls -l >/tmp/123 2>/dev/null
cat >2
</root/install.log
cat >123 //以ctrl+d为结束符
cat >123 <<eof //以eof为结束标志符
<< 表示为结束的输入字符
#脚本执行的错误跟踪 shell.sh >shell.log 2>&1
双向重定向tee(既在终端显示输出同时记录到文件,数据常用于shell脚本调试)
ls -l filename | tee test.log
#tee -a 参数允许数据累加,不加a是覆盖!