teeコマンドの使用
マニュアル
TEE(1) BSD General Commands Manual TEE(1)
NAME
tee -- pipe fitting
SYNOPSIS
tee [-ai] [file ...]
DESCRIPTION
The tee utility copies standard input to standard output, making a copy
in zero or more files. The output is unbuffered.
The following options are available:
-a Append the output to the files rather than overwriting them.
-i Ignore the SIGINT signal.
The following operands are available:
file A pathname of an output file.
The tee utility takes the default action for all signals, except in the
event of the -i option.
The tee utility exits 0 on success, and >0 if an error occurs.
STANDARDS
The tee function is expected to be POSIX IEEE Std 1003.2 (``POSIX.2'')
compatible.
BSD June 6, 1993 BSD
概要
簡単に言うと、これは双方向出力用のコマンドです。次のコマンドを例にとると、
touch test2 && cat test1 | tee test2 > /dev/null
最初に新しいファイルtest2を作成し、次にtest1のファイルの内容をパイプライン経由のteeコマンドの標準入力として使用しました。その後、teeコマンドは入力内容をtest2ファイルに上書きし、標準出力に出力する必要がある出力内容をホールにリダイレクトするため、標準出力の出力内容を確認できません。