echo to stdout并追加到文件

Ale*_*lls 4 bash shell echo

我有这个:

echo "all done creating tables" >> ${SUMAN_DEBUG_LOG_PATH}
Run Code Online (Sandbox Code Playgroud)

但这应该只附加到文件,而不是写入stdout.如何写入stdout并附加到同一bash行中的文件?

mau*_*uro 8

像这样的东西?

echo "all done creating tables" | tee -a  "${SUMAN_DEBUG_LOG_PATH}"
Run Code Online (Sandbox Code Playgroud)

  • 是的,如果您将 stderr 重定向到 stdout:`my_command 2>&1 | tee -a my_log` (2认同)