shell中将输出和错误重定向到日志文件

开始之前:

exec 3>&1
exec 4>&2
exec &>$LOGFILE

结束后还原:

exec 1>&3 3>&-
exec 2>&4 4>&-

猜你喜欢

转载自superlxw1234.iteye.com/blog/2110289