echo to stderr and tee to log file?

前端 未结 4 1624
青春惊慌失措
青春惊慌失措 2020-12-16 14:52

In bash script,

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

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

4条回答
  •  被撕碎了的回忆
    2020-12-16 15:33

    But default only stdout is passed along in pipes, so that in

    $ echo "error" | tee 
    

    tee only sees the stout from the echo, not the stderr. stderr will still be displayed in the terminal.

提交回复
热议问题