用一个简单的例子(echo在这里只是为了说明的目的):
$ echo’ee’| foo
ee < - 我想看到的输出 我知道tee可以复制stdout到文件,但这不是我想要的。
$ echo’ee’| tee output.txt | foo
我试过了
$ echo’ee’| tee / dev / stdout | foo但它不工作,因为tee输出到/ dev / stdout管道到foo
用一个简单的例子(echo在这里只是为了说明的目的):
$ echo’ee’| foo
ee < - 我想看到的输出 我知道tee可以复制stdout到文件,但这不是我想要的。
$ echo’ee’| tee output.txt | foo
我试过了
$ echo’ee’| tee / dev / stdout | foo但它不工作,因为tee输出到/ dev / stdout管道到foo
echo 'ee' | tee /dev/tty | foo
参考:The Open Group Base Specifications Issue 7
IEEE Std 1003.1,2013 Edition,§10.1:
/dev/tty
Associated with the process group of that process,if any. It is
useful for programs or shell procedures that wish to be sure of
writing messages to or reading data from the terminal no matter how output has been redirected. It can also be used for applications that demand the name of a file for output,when typed output is desired and it is tiresome to find out what terminal is currently in use. In each process,a synonym for the controlling terminal