覆盖写入
python xxxx.py | tee 1.log
追加写入
python xxxx.py | tee -a 1.log
没有tee的可以安装
Debian 系列
apt -y install coreutils
Redhat 系列
yum -y install coreutils
举例:在shell中调用py脚本且输出到对应日期下的.log文件
python xh_spark/xh_result_check.py $1 $2 | tee -a xh_spark/log/cdr/$(date +"%Y%m%d").log