% ls | tee sample.log
total 954
-rw-rw-r-- 1 user1 user1 684 Feb 26 15:11 sample1
-rw-r--r-- 1 user1 user1 422 Feb 26 10:24 sample2
% cat sample.log
total 954
-rw-rw-r-- 1 user1 user1 684 Feb 26 15:11 sample1
-rw-r--r-- 1 user1 user1 422 Feb 26 10:24 sample2
●tee コマンドの便利な使い方
tee コマンドは、make コマンドの実行時に使うと便利。make コマンドは、エラーが起こったとき途中で終了せずに、そのまま make の処理を続けることがある。その場合、どこで失敗したのか画面上で確認したくても、既に画面上からスクロールしてしまっている。だからといって、
% make >& make-log (csh・tcsh の場合)
% make >make-log 2>&1 (sh・bash の場合)