ere*_*zul 21 unix windows shell batch-file
我想运行一个ANT脚本,提示用户输入,因此需要通过控制台进行交互.同时我想将控制台内容记录到日志文件中.我知道我可以使用ant >build.log 2<&1哪个将重定向到文件,但将控制台留空.
那么,怎么做呢?在windows和unix上需要.
lav*_*nio 30
使用tee.
ant 2>&1|tee build.log
Run Code Online (Sandbox Code Playgroud)
tee.exe也适用于Windows,来自http://unxutils.sourceforge.net/
der*_*ert 16
你可以用tee.
例:
$ echo "Hello, world" | tee /tmp/outfile
Hello, world
$ cat /tmp/outfile
Hello, world
Run Code Online (Sandbox Code Playgroud)
tee 将stdin写入stdout以及命令行上给出的一个或多个文件.