tee 默认只能捕捉标准输出,使用下面方法可以同时捕捉错误输出。

cmd 2>&1 | tee file1