假设两个文件 test.sh
存在和test1.sh
不存在
ls test.sh test1.sh 1>svc.txt
把正确输出重定向到文件svc.txtls test.sh test1.sh 1>svc.txt 2>err.txt
把正确输出重定向到文件svc.txt,把错误输出重定向到文件err.txtls test.sh test1.sh 2>&- 或者 ls test.sh test1.sh 2>/dev/null
把错误输出关闭掉,不输出错误信息ls test.sh test1.sh 1>&- 2>&- 或者 ls test.sh test1.sh 1>/dev/null 2>/dev/null 或者 ls test.sh test1.sh &>/dev/null
关闭正确输出和错误输出ls test.sh test1.sh >/dev/null 2>&1
将正确输出关闭,错误输出重定向到正确输出使用的设备上去