在屏幕上打印stdout和stderr,并将它们重定向到不同的文件



我可以做

$./a.out 1>stdout_file 2>stderr_file

但是我在屏幕上什么也看不到。或者我可以做

$./a.out | tee log.log

但随后stdout和stderr会转到同一个文件。

我怎样才能做到这两点?

这对你有用吗?(我假设你在Linux上使用bash,不确定其他shell(:

./a.out 1> >(tee stdout.log) 2> >(tee stderr.log)

最新更新