stdoutとstderrをログファイルに書き込む必要がありますが、画面にはエラーメッセージのみが表示されます。私はこれを行うことができます:
cp -rpv a/* b 1> copyLog.txt 2> >(tee copyError.txt >&2)
ウェブのどこかで見つけました。
>(tee copyError.txt >&2)
ただこれが何と呼ばれるのか知りたいです。 Googleは山かっこや括弧などの文字を無視するため、Googleを検索できません。
ベストアンサー1
からman bash
:
Process Substitution
Process substitution is supported on systems that support
named pipes (FIFOs) or the /dev/fd method of naming open
files. It takes the form of <(list) or >(list). The process
list is run with its input or output connected to a FIFO or
some file in /dev/fd. The name of this file is passed as an
argument to the current command as the result of the expan‐
sion. If the >(list) form is used, writing to the file will
provide input for list. If the <(list) form is used, the
file passed as an argument should be read to obtain the out‐
put of list.
検索文字列をタップして入力して/
マンページを検索できます。これはこの情報を見つけるのに最適な方法です。もちろん、検索するマンページを知る必要があります。 :)
(
ただし、検索には特別な意味があるため、引用する必要があります。 bashのマンページで関連セクションを見つけるには、と入力します/>\(
。