RRFSx / rrfs-workflow_beta

GNU Lesser General Public License v3.0
0 stars 5 forks source link

modify PS4 to output more information for BASH debugging #81

Closed guoqing-noaa closed 3 months ago

guoqing-noaa commented 3 months ago

Use the following line at the beginning of every runtime BASH script (J-job, ex-scripts, and ush scripts) excluding sourced scripts.

declare -rx PS4='+ $(basename ${BASH_SOURCE[0]:-${FUNCNAME[0]:-"Unknown"}})[${LINENO}]${id}: '

so we can output information similar to the following to facilitate BASH debugging:

+ JRRFS_IC[31]: export pgmout=/lfs5/BMC/wrfruc/gge/nco/stmp/conus12km/1.0.1/rrfs.20240527/00/ic/OUTPUT.ic + JRRFS_IC[31]: pgmout=/lfs5/BMC/wrfruc/gge/nco/stmp/conus12km/1.0.1/rrfs.20240527/00/ic/OUTPUT.ic + JRRFS_IC[32]: /mnt/lfs5/BMC/wrfruc/gge/rrfs2/scripts/exrrfs_ic.sh + exrrfs_ic.sh[4]: cpreq='ln -snf' + exrrfs_ic.sh[5]: prefix=GFS + exrrfs_ic.sh[6]: cd /lfs5/BMC/wrfruc/gge/nco/stmp/conus12km/1.0.1/rrfs.20240527/00/ic