FCa*_*FCa 2 linux stdout pipe stderr io-redirection
有没有办法告诉Linux系统将所有输出(stdout,stderr)放到文件中?没有使用重定向,管道或修改如何调用scrips.
告诉Linux使用一个文件输出.
例如:script test1.sh:
#!/bin/bash
echo "Testing 123 "
Run Code Online (Sandbox Code Playgroud)
如果我运行它像"./test1.sh"(没有重定向或管道)我想在文件中看到"测试123"(/ tmp/linux_output)
问题:在系统中,二进制文件调用脚本,此脚本调用许多其他脚本.不可能修改每个调用所以如果我可以修改Linux将"输出"放到文件中我可以查看日志.
#!/bin/bash
exec >file 2>&1
echo "Testing 123 "
Run Code Online (Sandbox Code Playgroud)
你可以在这里阅读更多信息exec
| 归档时间: |
|
| 查看次数: |
140 次 |
| 最近记录: |