【发布时间】:2012-10-17 13:23:29
【问题描述】:
关于显示多个脚本的输出并同时将它们的 stout/stderr 写入日志文件,我有一个可能很简单(甚至可能已经回答)的问题:
我有一个脚本“my_script.sh”,它本身会调用另一个类似的脚本:
./my_to_be_logged_script.sh 2>&1 | tee -a "$LOGFILE"
my_to_be_logged_script.sh 在其他操作中调用一个 Python 脚本和另一个类似的 shell 脚本:
./my_to_be_logged_shell_subscript.sh
python "my_to_be_logged_py_subscript.py"
首先,所有内容都正确记录到 LOGFILE。
shell 脚本输出是实时显示的,但控制台仅在 Python 脚本完成后才会显示 Python 脚本的输出。有没有办法实时显示 Python 输出?
【问题讨论】:
-
Python output buffering 的可能重复项