如何將腳本的stdout和stderr重定向到文件,同時將腳本的stderr發送到標準輸出。非標準io重定向
舉例說明:
testscript:
#!/bin/bash
echo "this goes to stdout"
echo "this goes to stderr" >&2
以這樣的方式執行testscript它打印此控制檯:
this goes to stderr
,這轉到日誌文件:
this goes to stdout
this goes to stderr
我覺得我近距離使用fifo
,但從未到過那裏。需要的是stderr的tee
。想法?