我有 bash 脚本:
echo "Hello world"
ls -la
如何让这个脚本打印stdout
并stderr
以info.log
文件?
如何让这个脚本打印stdout
并stderr
以info.log
文件和屏幕?
您可以像这样运行脚本来重定向stdout
和重定向stderr
到文件。
./yourScript.sh > info.log 2>&1
要重定向到文件以及控制台,您可以使用 tee
./yourScript.sh 2>&1 | tee info.log
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句