2017年5月15日 星期一

[linux] stderr

https://blog.longwin.com.tw/2013/03/stdin-stdout-stderr-redirection-2013/

  • 0: stdin (Standard input) 標準輸入串流 (鍵盤輸入)
  • 1: stdout (Standard output) 標準輸出串流 (輸出於 Cli 視窗)
  • 2: stderr (Standard error) 標準錯誤輸出串流 (輸出於 Cli 視窗)
簡單易懂的圖片可見(取自: Standard streams - Wikipedia, the free encyclopedia):
The standard streams for input, output, and error
The standard streams for input, output, and error







redirect the output to a file:
someCommand > someFile.txt  
Or if you want to append data:
someCommand >> someFile.txt
If you want stderr too use this:
someCommand &> someFile.txt  
or this to append:
someCommand &>> someFile.txt  


沒有留言:

張貼留言