$>emtry_or_create_a_file.f
$ll>>append_a_file.f
standard output input error
$ls -l /usr/bin >ok.txt 标准输出文件有内容 运行正确的结果信息
$ls -l /bin/usr 2 >ok.txt 标准输出文件有内容 运行错误信息
0 input
1 output
2 error
$ls -l /bin/usr >emptry.txt 标准输出文件无内容 不会将结果输出 缺少文件描述符中的2
将标准输出和标准错误重定向到一个文件的2种办法
$ll /bin/usr >o.f 2>&1
$ll /bin/usr & > o.f
标准错误将重定向到屏幕
$ll /bin/usr 2>&1>o.f
不希望的到输出
$ll /bin/usr 2 >/dev/null
$x 2>/dev/null
file descriptor 0 1 2 一切皆文件 stdout stderr stdin
原文:http://www.cnblogs.com/yuanjiangw/p/7750279.html