2011-08-19 92 views
1

我想將make命令的輸出和錯誤流重定向到文件。使輸出重定向

以下命令

make 1>&2 ~/tmp/build.log 

引發以下錯誤

make: Nothing to be done for `/Users/m/tmp/build.log'. 

編輯: -

試過

make 2>&1 ~/tmp/build.log 

make ~/tmp/build.log 2>&1 

它給出了同樣的上述錯誤信息。

我使用mac OS豹

$ bash --version 
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) 
Copyright (C) 2007 Free Software Foundation, Inc. 
Tietos-iMac-2:qt-build ptools$ sh --version 
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) 
Copyright (C) 2007 Free Software Foundation, Inc. 

回答

7

應該

make 2>&1 > ~/tmp/build.log 
+1

沒有,'2>&1' :) __ – arnaud576875

+0

@ arnaud576875:福氣(傻''''' ''''填充要求,呃) – sehe

+1

你需要把2>&1放在最後或者它不起作用 –