Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 576 Bytes

tee.md

File metadata and controls

19 lines (12 loc) · 576 Bytes

tee

使用tee指令同時顯示log並存入檔案

在Mac上log只會被導到一個地方,要嘛就是營幕上(stdout),要嘛就是某個檔案內。那如果我需要將log顯示在畫面上又希望它能被保存呢?這時候可以利用tee這個pipeline工具

使用方式為

$ <some_command> | tee [file_to_save_log]

adb logcat為範例:

$ adb logcat | tee ~/my_logcat_output.txt

這個範例中adb logcat的輸出除了會顯示在畫面上外,也會被保存到~/my_logcat_output.txt這個檔案裡面。