Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のように、tee を使用して stdout とファイルの両方に出力を送信できます。
./process.sh | tee output.log
完全な出力を stdout に送信し、grep された出力をファイルに送信するにはどうすればよいですか?
tee は 2 番目のファイル引数を想定しているため、これは機能しません。
./process.sh | tee | grep foo > output.log
出力を にリダイレクトする別の回答に加えて、スタイルのプロセス置換/dev/ttyをサポートするシェル (および OS) を使用する場合、bashこれを行うことができます。
/dev/tty
bash
./process.sh | tee >(grep foo > output.log)