Linux 重定向
Linux provide three channel for I/O
check: ls -l /dev/std*
0: standard input
1: standard output
2: standard error oupput
默认情况下:
输入:0
标准输出:1
错误输出:2
重定向:
从文件输入:more < test.txt
将结果输出到文件:ls -l > test.txt
将错误输出到文件:ls -l 2>error.txt
一般如果既不想让错误输出到屏幕,又不想存储错误:命令 2>/dev/null
put all output into one destintation:
ls -l > test.txt 2>&1
>: overwrite
>>: append
Comments
Post a Comment