回显到stderr和发球台到日志文件? [英] echo to stderr and tee to log file?

查看:92
本文介绍了回显到stderr和发球台到日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在bash脚本,

回声错误1>和2 |三通-a登录

echo "error" 1>&2 | tee -a log

将打印标准错误的屏幕,但没有记录到文件,如何在同一时间做这些?

will print stderr in screen but no log to file, how to do these at same time?

推荐答案

要呼应的文字都在日志文件和标准错误,的但不是标准输出的,试试这个:

To echo the text to both the log file and stderr, but not stdout, try this:

echo "error" | tee -a log 1>&2

这篇关于回显到stderr和发球台到日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆