原因がわからない問題に遭遇しました。説明する最も簡単な方法は、コード例によるものだと思います。
test ()
{
echo "This will be printed to the file"
#But the output of rsync will not
rsync -av /path/A /path/B
echo "This will be printed to the file"
}
function_calling_test ()
{
test | tee -a "file_B.txt"
}
function_calling_test | tee -a "file_A.txt"
上記の例では、 file_A.txtにはecho出力と関数"test"からのrsync出力の両方が含まれますが、file_B.txtにはecho出力のみが含まれます。どうしてこれなの?