Debian

如何把Shell的執行過程存到檔案


參考資訊:
1. how-can-i-fully-log-all-bash-scripts-actions

步驟如下:

#!/bin/bash
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>log.out 2>&1
# Everything below will go to the file 'log.out':


返回上一頁