如何既stdout和stderr重定向到一个文件
问题描述:
你好我正在运行的命令的执行
Hi I am running a bash script that creates a log file for the execution of the command
我用下面的
Command1 >> log_file
Command2 >> log_file
这仅发送标准输出,而不是标准的错误出现在终端上。
This only sends the standard output and not the standard error which appears on the terminal.
我可以登录这两个标准错误和stdout记录到一个文件?
Can I log both the stderr and stdout logged to a file?
答
如果你想登录到同一文件:
If you want to log to the same file:
command1 >> log_file 2>&1
如果你想不同的文件:
command1 >> log_file 2>> err_file