Posted on 2010-12-03 14:35
S.l.e!ep.¢% 閱讀(1069)
評論(0) 編輯 收藏 引用 所屬分類:
Unix
在shell中,文件描述符通常是:STDIN標準輸入,STDOUT標準輸出,STDERR標準錯誤輸出,即:0,1,2,
例子:nohup abc.sh > nohup.log 2>&1 &
其中2>&1? 指將STDERR重定向到前面標準輸出定向到的同名文件中,即&1就是nohup.log
那么結果就是當執行的命令發生標準錯誤,那么這個錯誤也會輸出到你指定的輸出文件中?
nohup把abc.sh的輸出重定向到文件nohup.log 同時出現錯誤也輸出到nohup.log ,然后后臺執行。
There are two formats for redirecting standard output and standard error:
&>word
and
>&word
Of the two forms, the first is preferred. This is semantically equivalent to
>word 2>&1