diff --git a/dev/job_cards/rocoto/prep.sh b/dev/job_cards/rocoto/prep.sh index aff226f048..7626eba615 100755 --- a/dev/job_cards/rocoto/prep.sh +++ b/dev/job_cards/rocoto/prep.sh @@ -170,10 +170,10 @@ fi # Create or Copy prepbufr, prepbufr.acft_profiles, nsstbufr files # Do not fail on external errors if [[ ${MAKE_PREPBUFR:-"YES"} == "YES" ]]; then - unset_strict + source "${USHglobal}/unset_strict.sh" "${HOMEobsproc}/jobs/JOBSPROC_GLOBAL_PREP" && true export err=$? - set_strict + source "${USHglobal}/set_strict.sh" if [[ ${err} -ne 0 ]]; then err_exit "JOBSPROC_GLOBAL_PREP job failed, ABORT!" fi diff --git a/dev/jobs/JGDAS_AERO_ANALYSIS_GENERATE_BMATRIX b/dev/jobs/JGDAS_AERO_ANALYSIS_GENERATE_BMATRIX index 10be86d923..1495be3bcb 100755 --- a/dev/jobs/JGDAS_AERO_ANALYSIS_GENERATE_BMATRIX +++ b/dev/jobs/JGDAS_AERO_ANALYSIS_GENERATE_BMATRIX @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGDAS_ATMOS_CHGRES_FORENKF b/dev/jobs/JGDAS_ATMOS_CHGRES_FORENKF index 78fdcc86d0..aca0092a40 100755 --- a/dev/jobs/JGDAS_ATMOS_CHGRES_FORENKF +++ b/dev/jobs/JGDAS_ATMOS_CHGRES_FORENKF @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGDAS_ATMOS_GEMPAK b/dev/jobs/JGDAS_ATMOS_GEMPAK index c2be5c7e84..be336132c3 100755 --- a/dev/jobs/JGDAS_ATMOS_GEMPAK +++ b/dev/jobs/JGDAS_ATMOS_GEMPAK @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export GRIB=${GRIB:-pgrb2f} export EXT="" diff --git a/dev/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC b/dev/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC index 33980e08ae..ec44aaf00f 100755 --- a/dev/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC +++ b/dev/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC @@ -14,6 +14,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Now set up GEMPAK/NTRANS environment diff --git a/dev/jobs/JGDAS_ATMOS_VERFOZN b/dev/jobs/JGDAS_ATMOS_VERFOZN index dde005c009..d763dcd0af 100755 --- a/dev/jobs/JGDAS_ATMOS_VERFOZN +++ b/dev/jobs/JGDAS_ATMOS_VERFOZN @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################# # determine PDY and cyc for previous cycle diff --git a/dev/jobs/JGDAS_ATMOS_VERFRAD b/dev/jobs/JGDAS_ATMOS_VERFRAD index 9f0d8d2124..b04d4e5ed2 100755 --- a/dev/jobs/JGDAS_ATMOS_VERFRAD +++ b/dev/jobs/JGDAS_ATMOS_VERFRAD @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################# # determine PDY and cyc for previous cycle diff --git a/dev/jobs/JGDAS_ENKF_POST b/dev/jobs/JGDAS_ENKF_POST index ad85dfc139..5c0cb7e5f9 100755 --- a/dev/jobs/JGDAS_ENKF_POST +++ b/dev/jobs/JGDAS_ENKF_POST @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGDAS_FIT2OBS b/dev/jobs/JGDAS_FIT2OBS index c0593ef5f0..9b44ceeebe 100755 --- a/dev/jobs/JGDAS_FIT2OBS +++ b/dev/jobs/JGDAS_FIT2OBS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGEFS_WAVE_STAT b/dev/jobs/JGEFS_WAVE_STAT index eeb3d8a977..65692171ee 100755 --- a/dev/jobs/JGEFS_WAVE_STAT +++ b/dev/jobs/JGEFS_WAVE_STAT @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" source "${USHglobal}/wave_domain_grid.sh" # Set COM Paths diff --git a/dev/jobs/JGEFS_WAVE_STAT_PNT b/dev/jobs/JGEFS_WAVE_STAT_PNT index 9622a14612..b43cfd12cd 100755 --- a/dev/jobs/JGEFS_WAVE_STAT_PNT +++ b/dev/jobs/JGEFS_WAVE_STAT_PNT @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Set COM Paths diff --git a/dev/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG b/dev/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG index 4d51edd04c..6646924e20 100755 --- a/dev/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG +++ b/dev/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} diff --git a/dev/jobs/JGFS_ATMOS_CYCLONE_GENESIS b/dev/jobs/JGFS_ATMOS_CYCLONE_GENESIS index b9865c017e..ad3a809bdb 100755 --- a/dev/jobs/JGFS_ATMOS_CYCLONE_GENESIS +++ b/dev/jobs/JGFS_ATMOS_CYCLONE_GENESIS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the exglobal script @@ -43,10 +46,10 @@ export JYYYY=${PDY:0:4} ############################################## # Do not fail on errors or unassigned variables in external code -unset_strict +source "${USHglobal}/unset_strict.sh" "${SCRIPTens_tracker}/exgfs_tc_genesis.sh" && true export err=$? -set_strict +source "${USHglobal}/set_strict.sh" if [[ ${err} -ne 0 ]]; then err_exit fi diff --git a/dev/jobs/JGFS_ATMOS_CYCLONE_TRACKER b/dev/jobs/JGFS_ATMOS_CYCLONE_TRACKER index 290fd36a55..522c6b8844 100755 --- a/dev/jobs/JGFS_ATMOS_CYCLONE_TRACKER +++ b/dev/jobs/JGFS_ATMOS_CYCLONE_TRACKER @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export COMPONENT="atmos" diff --git a/dev/jobs/JGFS_ATMOS_FBWIND b/dev/jobs/JGFS_ATMOS_FBWIND index 56f6092280..47b376921e 100755 --- a/dev/jobs/JGFS_ATMOS_FBWIND +++ b/dev/jobs/JGFS_ATMOS_FBWIND @@ -15,6 +15,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export COMPONENT="atmos" diff --git a/dev/jobs/JGFS_ATMOS_FSU_GENESIS b/dev/jobs/JGFS_ATMOS_FSU_GENESIS index db9073465b..e78b24b63f 100755 --- a/dev/jobs/JGFS_ATMOS_FSU_GENESIS +++ b/dev/jobs/JGFS_ATMOS_FSU_GENESIS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Define COM and Data directories diff --git a/dev/jobs/JGFS_ATMOS_GEMPAK b/dev/jobs/JGFS_ATMOS_GEMPAK index 2923db68b4..5ceabbe49b 100755 --- a/dev/jobs/JGFS_ATMOS_GEMPAK +++ b/dev/jobs/JGFS_ATMOS_GEMPAK @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################ # Set up model and cycle specific variables diff --git a/dev/jobs/JGFS_ATMOS_GEMPAK_META b/dev/jobs/JGFS_ATMOS_GEMPAK_META index 2d1d6cff8d..d8d7f541c2 100755 --- a/dev/jobs/JGFS_ATMOS_GEMPAK_META +++ b/dev/jobs/JGFS_ATMOS_GEMPAK_META @@ -15,6 +15,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################### # Set MP variables diff --git a/dev/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF b/dev/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF index 1a4b7d6f48..266804dd0f 100755 --- a/dev/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF +++ b/dev/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export MP_PULSE=0 export MP_TIMEOUT=2000 diff --git a/dev/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC b/dev/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC index f9957cb94a..ad94602615 100755 --- a/dev/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC +++ b/dev/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export COMPONENT="atmos" export EXT="" diff --git a/dev/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS b/dev/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS index 2bdc165266..c3b51d3009 100755 --- a/dev/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS +++ b/dev/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS @@ -15,6 +15,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} diff --git a/dev/jobs/JGFS_ATMOS_POSTSND b/dev/jobs/JGFS_ATMOS_POSTSND index ac99d8ceeb..08fd0610dc 100755 --- a/dev/jobs/JGFS_ATMOS_POSTSND +++ b/dev/jobs/JGFS_ATMOS_POSTSND @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ######################################## # Runs GFS BUFR SOUNDINGS diff --git a/dev/jobs/JGFS_ATMOS_VERIFICATION b/dev/jobs/JGFS_ATMOS_VERIFICATION index ac3f889b12..15986bffa9 100755 --- a/dev/jobs/JGFS_ATMOS_VERIFICATION +++ b/dev/jobs/JGFS_ATMOS_VERIFICATION @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################################### ## Abstract: @@ -38,11 +41,11 @@ done if [[ "${RUN_GRID2GRID_STEP1}" == "YES" || "${RUN_GRID2OBS_STEP1}" == "YES" || "${RUN_PRECIP_STEP1}" == "YES" ]]; then # Override the -e in VERIF_GLOBALSH's shebang and un-export SHELLOPTS # TODO: clean up the verif-global script so it does not raise false-positive errors - unset_strict + source "${USHglobal}/unset_strict.sh" export -n SHELLOPTS bash -x "${VERIF_GLOBALSH}" err=$? - set_strict + source "${USHglobal}/set_strict.sh" if [[ ${err} -ne 0 ]]; then exit "${err}" fi diff --git a/dev/jobs/JGLOBAL_AERO_ANALYSIS_FINALIZE b/dev/jobs/JGLOBAL_AERO_ANALYSIS_FINALIZE index e7fb98be11..8670534fdb 100755 --- a/dev/jobs/JGLOBAL_AERO_ANALYSIS_FINALIZE +++ b/dev/jobs/JGLOBAL_AERO_ANALYSIS_FINALIZE @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_AERO_ANALYSIS_INITIALIZE b/dev/jobs/JGLOBAL_AERO_ANALYSIS_INITIALIZE index 9b91bcda1b..7e4808e431 100755 --- a/dev/jobs/JGLOBAL_AERO_ANALYSIS_INITIALIZE +++ b/dev/jobs/JGLOBAL_AERO_ANALYSIS_INITIALIZE @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_AERO_ANALYSIS_VARIATIONAL b/dev/jobs/JGLOBAL_AERO_ANALYSIS_VARIATIONAL index fda8300d66..9a34c70930 100755 --- a/dev/jobs/JGLOBAL_AERO_ANALYSIS_VARIATIONAL +++ b/dev/jobs/JGLOBAL_AERO_ANALYSIS_VARIATIONAL @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ANALYSIS_STATS b/dev/jobs/JGLOBAL_ANALYSIS_STATS index bcfde48bb7..f103aaf115 100755 --- a/dev/jobs/JGLOBAL_ANALYSIS_STATS +++ b/dev/jobs/JGLOBAL_ANALYSIS_STATS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ARCHIVE_TARS b/dev/jobs/JGLOBAL_ARCHIVE_TARS index 86aed85595..032bdaa3fe 100755 --- a/dev/jobs/JGLOBAL_ARCHIVE_TARS +++ b/dev/jobs/JGLOBAL_ARCHIVE_TARS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" if [[ "${DO_WAVE}" == "YES" ]]; then source "${EXPDIR}/config.wave" source "${USHglobal}/wave_domain_grid.sh" @@ -104,10 +107,10 @@ fi # Do not export shell opts to the bash scripts in the htar/hsi wrappers export -n SHELLOPTS -unset_strict +source "${USHglobal}/unset_strict.sh" ${GLOBALARCHIVESH:-${SCRglobal}/exglobal_archive_tars.py} export err=$? -set_strict +source "${USHglobal}/set_strict.sh" if [[ ${err} -ne 0 ]]; then err_exit "failed to archive the COM structure" fi diff --git a/dev/jobs/JGLOBAL_ARCHIVE_VRFY b/dev/jobs/JGLOBAL_ARCHIVE_VRFY index c3dc8d9341..5ccf76dbff 100755 --- a/dev/jobs/JGLOBAL_ARCHIVE_VRFY +++ b/dev/jobs/JGLOBAL_ARCHIVE_VRFY @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FINALIZE b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FINALIZE index 997e88ba7d..444039be35 100755 --- a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FINALIZE +++ b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FINALIZE @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FV3_INCREMENT b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FV3_INCREMENT index c81dac9f8b..31e5835485 100755 --- a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FV3_INCREMENT +++ b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_FV3_INCREMENT @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_INITIALIZE b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_INITIALIZE index d41bc8eef0..fb23246ab8 100755 --- a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_INITIALIZE +++ b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_INITIALIZE @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_LETKF b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_LETKF index 7e32598ee6..0c2b98ea58 100755 --- a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_LETKF +++ b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_LETKF @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_OBS b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_OBS index b36dcfff88..cbf8a42b3e 100755 --- a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_OBS +++ b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_OBS @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_SOL b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_SOL index da4436d101..375a81cb25 100755 --- a/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_SOL +++ b/dev/jobs/JGLOBAL_ATMENS_ANALYSIS_SOL @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS index 00ab41c25d..fa2a2305cf 100755 --- a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS +++ b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC index 583b607ec0..05e69958b6 100755 --- a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC +++ b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Setup Python path for pygfs PYTHONPATH="${HOMEglobal}/ush/python${PYTHONPATH:+:${PYTHONPATH}}" diff --git a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC_FV3JEDI b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC_FV3JEDI index 5ce9e6af31..2572fe0e78 100755 --- a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC_FV3JEDI +++ b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC_FV3JEDI @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_DIAG b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_DIAG index 2d24c5ed04..e993909c78 100755 --- a/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_DIAG +++ b/dev/jobs/JGLOBAL_ATMOS_ANALYSIS_DIAG @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATMOS_CHGRES_GEN_CONTROL b/dev/jobs/JGLOBAL_ATMOS_CHGRES_GEN_CONTROL index a3f746f8c6..0432503962 100755 --- a/dev/jobs/JGLOBAL_ATMOS_CHGRES_GEN_CONTROL +++ b/dev/jobs/JGLOBAL_ATMOS_CHGRES_GEN_CONTROL @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Initial conditions are from previous GFS cycle, but valid at the end of the cycle GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours") diff --git a/dev/jobs/JGLOBAL_ATMOS_ENSSTAT b/dev/jobs/JGLOBAL_ATMOS_ENSSTAT index 809a962c94..daa9773335 100755 --- a/dev/jobs/JGLOBAL_ATMOS_ENSSTAT +++ b/dev/jobs/JGLOBAL_ATMOS_ENSSTAT @@ -14,6 +14,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Begin JOB SPECIFIC work diff --git a/dev/jobs/JGLOBAL_ATMOS_POST_MANAGER b/dev/jobs/JGLOBAL_ATMOS_POST_MANAGER index 0a437f85fe..33582bbf59 100755 --- a/dev/jobs/JGLOBAL_ATMOS_POST_MANAGER +++ b/dev/jobs/JGLOBAL_ATMOS_POST_MANAGER @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" #################################### # Specify NET and RUN Name and model diff --git a/dev/jobs/JGLOBAL_ATMOS_PREP_SFC b/dev/jobs/JGLOBAL_ATMOS_PREP_SFC index efb2906486..f11d05717e 100755 --- a/dev/jobs/JGLOBAL_ATMOS_PREP_SFC +++ b/dev/jobs/JGLOBAL_ATMOS_PREP_SFC @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set date and cycle diff --git a/dev/jobs/JGLOBAL_ATMOS_PRODUCTS b/dev/jobs/JGLOBAL_ATMOS_PRODUCTS index 668e8d7800..a500aeb538 100755 --- a/dev/jobs/JGLOBAL_ATMOS_PRODUCTS +++ b/dev/jobs/JGLOBAL_ATMOS_PRODUCTS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Begin JOB SPECIFIC work diff --git a/dev/jobs/JGLOBAL_ATMOS_SFCANL b/dev/jobs/JGLOBAL_ATMOS_SFCANL index 4859c8b806..551e4d5957 100755 --- a/dev/jobs/JGLOBAL_ATMOS_SFCANL +++ b/dev/jobs/JGLOBAL_ATMOS_SFCANL @@ -9,6 +9,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Begin JOB SPECIFIC work diff --git a/dev/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC b/dev/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC index b5ec6efe66..12100b22a9 100755 --- a/dev/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC +++ b/dev/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Begin JOB SPECIFIC work diff --git a/dev/jobs/JGLOBAL_ATMOS_UPP b/dev/jobs/JGLOBAL_ATMOS_UPP index d79887bb6c..d7755db6f5 100755 --- a/dev/jobs/JGLOBAL_ATMOS_UPP +++ b/dev/jobs/JGLOBAL_ATMOS_UPP @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the exglobal script diff --git a/dev/jobs/JGLOBAL_ATMOS_VMINMON b/dev/jobs/JGLOBAL_ATMOS_VMINMON index dd84e8755c..c933f918c8 100755 --- a/dev/jobs/JGLOBAL_ATMOS_VMINMON +++ b/dev/jobs/JGLOBAL_ATMOS_VMINMON @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################# # Determine PDY and cyc for previous cycle diff --git a/dev/jobs/JGLOBAL_ATM_ANALYSIS_FINALIZE b/dev/jobs/JGLOBAL_ATM_ANALYSIS_FINALIZE index 4962931d69..c3e2d5ce08 100755 --- a/dev/jobs/JGLOBAL_ATM_ANALYSIS_FINALIZE +++ b/dev/jobs/JGLOBAL_ATM_ANALYSIS_FINALIZE @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATM_ANALYSIS_FV3_INCREMENT b/dev/jobs/JGLOBAL_ATM_ANALYSIS_FV3_INCREMENT index 659d9f0e50..21b88e1f81 100755 --- a/dev/jobs/JGLOBAL_ATM_ANALYSIS_FV3_INCREMENT +++ b/dev/jobs/JGLOBAL_ATM_ANALYSIS_FV3_INCREMENT @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATM_ANALYSIS_INITIALIZE b/dev/jobs/JGLOBAL_ATM_ANALYSIS_INITIALIZE index d82f2d9c56..af4d6badd0 100755 --- a/dev/jobs/JGLOBAL_ATM_ANALYSIS_INITIALIZE +++ b/dev/jobs/JGLOBAL_ATM_ANALYSIS_INITIALIZE @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATM_ANALYSIS_VARIATIONAL b/dev/jobs/JGLOBAL_ATM_ANALYSIS_VARIATIONAL index fbefb87bb6..b35d5587c5 100755 --- a/dev/jobs/JGLOBAL_ATM_ANALYSIS_VARIATIONAL +++ b/dev/jobs/JGLOBAL_ATM_ANALYSIS_VARIATIONAL @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ATM_PREP_ANL_BIAS b/dev/jobs/JGLOBAL_ATM_PREP_ANL_BIAS index 9d53b0841e..aa4c15c04f 100755 --- a/dev/jobs/JGLOBAL_ATM_PREP_ANL_BIAS +++ b/dev/jobs/JGLOBAL_ATM_PREP_ANL_BIAS @@ -11,6 +11,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_CLEANUP b/dev/jobs/JGLOBAL_CLEANUP index 9ae25b4bee..976ff97ac5 100755 --- a/dev/jobs/JGLOBAL_CLEANUP +++ b/dev/jobs/JGLOBAL_CLEANUP @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" "${SCRglobal}/exglobal_cleanup.sh" && true export err=$? diff --git a/dev/jobs/JGLOBAL_ENKF_ARCHIVE_TARS b/dev/jobs/JGLOBAL_ENKF_ARCHIVE_TARS index e74e8a3cfb..4cecdce39f 100755 --- a/dev/jobs/JGLOBAL_ENKF_ARCHIVE_TARS +++ b/dev/jobs/JGLOBAL_ENKF_ARCHIVE_TARS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script @@ -35,10 +38,10 @@ mkdir -p "${COMIN_CONF}" # Calls an external bash command; do not fail on unassigned/error export -n SHELLOPTS -unset_strict +source "${USHglobal}/unset_strict.sh" "${SCRglobal}/exglobal_enkf_earc_tars.py" export err=$? -set_strict +source "${USHglobal}/set_strict.sh" if [[ ${err} -ne 0 ]]; then err_exit "Failed to archive the ensemble COM structure" fi diff --git a/dev/jobs/JGLOBAL_ENKF_ARCHIVE_VRFY b/dev/jobs/JGLOBAL_ENKF_ARCHIVE_VRFY index 4f94c65100..81c7141339 100755 --- a/dev/jobs/JGLOBAL_ENKF_ARCHIVE_VRFY +++ b/dev/jobs/JGLOBAL_ENKF_ARCHIVE_VRFY @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ENKF_DIAG b/dev/jobs/JGLOBAL_ENKF_DIAG index d3f6c7ed77..acbf00b149 100755 --- a/dev/jobs/JGLOBAL_ENKF_DIAG +++ b/dev/jobs/JGLOBAL_ENKF_DIAG @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ENKF_ECEN b/dev/jobs/JGLOBAL_ENKF_ECEN index 9f77310506..867c940d90 100755 --- a/dev/jobs/JGLOBAL_ENKF_ECEN +++ b/dev/jobs/JGLOBAL_ENKF_ECEN @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ENKF_ECEN_FV3JEDI b/dev/jobs/JGLOBAL_ENKF_ECEN_FV3JEDI index 78c6afe3b1..9b148bde8f 100755 --- a/dev/jobs/JGLOBAL_ENKF_ECEN_FV3JEDI +++ b/dev/jobs/JGLOBAL_ENKF_ECEN_FV3JEDI @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ENKF_SELECT_OBS b/dev/jobs/JGLOBAL_ENKF_SELECT_OBS index cc754c39c4..9a193d64f6 100755 --- a/dev/jobs/JGLOBAL_ENKF_SELECT_OBS +++ b/dev/jobs/JGLOBAL_ENKF_SELECT_OBS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script @@ -64,7 +67,7 @@ fi LEVS=$(${NCLEN} "${ATMGES_ENSMEAN}" pfull) && true export err=$? -set_strict +source "${USHglobal}/set_strict.sh" export LEVS diff --git a/dev/jobs/JGLOBAL_ENKF_SFC b/dev/jobs/JGLOBAL_ENKF_SFC index 34a31d9d2c..e4f3749f38 100755 --- a/dev/jobs/JGLOBAL_ENKF_SFC +++ b/dev/jobs/JGLOBAL_ENKF_SFC @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ENKF_UPDATE b/dev/jobs/JGLOBAL_ENKF_UPDATE index 3cb02d4d31..38564406d8 100755 --- a/dev/jobs/JGLOBAL_ENKF_UPDATE +++ b/dev/jobs/JGLOBAL_ENKF_UPDATE @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_ENS_GLOBUS_ARCH b/dev/jobs/JGLOBAL_ENS_GLOBUS_ARCH index 5492f0d174..27a5dac0b4 100755 --- a/dev/jobs/JGLOBAL_ENS_GLOBUS_ARCH +++ b/dev/jobs/JGLOBAL_ENS_GLOBUS_ARCH @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_EXTRACTVARS b/dev/jobs/JGLOBAL_EXTRACTVARS index af25a498c6..d2c535f138 100755 --- a/dev/jobs/JGLOBAL_EXTRACTVARS +++ b/dev/jobs/JGLOBAL_EXTRACTVARS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" source "${USHglobal}/wave_domain_grid.sh" # Set COM Paths diff --git a/dev/jobs/JGLOBAL_FETCH b/dev/jobs/JGLOBAL_FETCH index 748d917186..f86d54d1ce 100755 --- a/dev/jobs/JGLOBAL_FETCH +++ b/dev/jobs/JGLOBAL_FETCH @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Setup Python path for pygfs PYTHONPATH="${HOMEglobal}/ush/python${PYTHONPATH:+:${PYTHONPATH}}" diff --git a/dev/jobs/JGLOBAL_FORECAST b/dev/jobs/JGLOBAL_FORECAST index 03371f568d..1b07b4b516 100755 --- a/dev/jobs/JGLOBAL_FORECAST +++ b/dev/jobs/JGLOBAL_FORECAST @@ -23,6 +23,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Setup Python path for pygfs PYTHONPATH="${HOMEglobal}/ush/python${PYTHONPATH:+:${PYTHONPATH}}" diff --git a/dev/jobs/JGLOBAL_GLOBUS_ARCH b/dev/jobs/JGLOBAL_GLOBUS_ARCH index 721c183503..a70a0b1302 100755 --- a/dev/jobs/JGLOBAL_GLOBUS_ARCH +++ b/dev/jobs/JGLOBAL_GLOBUS_ARCH @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_CHECKPOINT b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_CHECKPOINT index 9b24b6e18a..185f778406 100755 --- a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_CHECKPOINT +++ b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_CHECKPOINT @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_ECEN b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_ECEN index 5bde481bbc..b0c379f177 100755 --- a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_ECEN +++ b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_ECEN @@ -14,6 +14,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_FINALIZE b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_FINALIZE index 5030b260ac..4519425025 100755 --- a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_FINALIZE +++ b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_FINALIZE @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_INITIALIZE b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_INITIALIZE index 4f2b466ac0..13cb08372f 100755 --- a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_INITIALIZE +++ b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_INITIALIZE @@ -12,6 +12,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_LETKF b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_LETKF index d23967ea4b..171308b85f 100755 --- a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_LETKF +++ b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_LETKF @@ -16,6 +16,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_VARIATIONAL b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_VARIATIONAL index a895586592..349a7096c5 100755 --- a/dev/jobs/JGLOBAL_MARINE_ANALYSIS_VARIATIONAL +++ b/dev/jobs/JGLOBAL_MARINE_ANALYSIS_VARIATIONAL @@ -13,6 +13,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_BMAT b/dev/jobs/JGLOBAL_MARINE_BMAT index 314b83d9ca..e499590e62 100755 --- a/dev/jobs/JGLOBAL_MARINE_BMAT +++ b/dev/jobs/JGLOBAL_MARINE_BMAT @@ -20,6 +20,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_MARINE_BMAT_INITIALIZE b/dev/jobs/JGLOBAL_MARINE_BMAT_INITIALIZE index 8ccf6b2cde..df272897b2 100755 --- a/dev/jobs/JGLOBAL_MARINE_BMAT_INITIALIZE +++ b/dev/jobs/JGLOBAL_MARINE_BMAT_INITIALIZE @@ -21,6 +21,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_OCEANICE_PRODUCTS b/dev/jobs/JGLOBAL_OCEANICE_PRODUCTS index 22b7513be5..a54aa565ce 100755 --- a/dev/jobs/JGLOBAL_OCEANICE_PRODUCTS +++ b/dev/jobs/JGLOBAL_OCEANICE_PRODUCTS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Setup Python path for pygfs PYTHONPATH="${HOMEglobal}/ush/python${PYTHONPATH:+:${PYTHONPATH}}" diff --git a/dev/jobs/JGLOBAL_OFFLINE_ATMOS_ANALYSIS b/dev/jobs/JGLOBAL_OFFLINE_ATMOS_ANALYSIS index 5f5bb77e1b..b4be32d22c 100755 --- a/dev/jobs/JGLOBAL_OFFLINE_ATMOS_ANALYSIS +++ b/dev/jobs/JGLOBAL_OFFLINE_ATMOS_ANALYSIS @@ -9,6 +9,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_PREP_EMISSIONS b/dev/jobs/JGLOBAL_PREP_EMISSIONS index ad8dbe822f..b248821537 100755 --- a/dev/jobs/JGLOBAL_PREP_EMISSIONS +++ b/dev/jobs/JGLOBAL_PREP_EMISSIONS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_PREP_OCEAN_OBS b/dev/jobs/JGLOBAL_PREP_OCEAN_OBS index 0ecd487313..d3c1125fea 100755 --- a/dev/jobs/JGLOBAL_PREP_OCEAN_OBS +++ b/dev/jobs/JGLOBAL_PREP_OCEAN_OBS @@ -9,6 +9,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_SNOWENS_ANALYSIS b/dev/jobs/JGLOBAL_SNOWENS_ANALYSIS index 549258bc27..eb0a788c83 100755 --- a/dev/jobs/JGLOBAL_SNOWENS_ANALYSIS +++ b/dev/jobs/JGLOBAL_SNOWENS_ANALYSIS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_SNOW_ANALYSIS b/dev/jobs/JGLOBAL_SNOW_ANALYSIS index 04f3d19766..10e0b17106 100755 --- a/dev/jobs/JGLOBAL_SNOW_ANALYSIS +++ b/dev/jobs/JGLOBAL_SNOW_ANALYSIS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ############################################## # Set variables used in the script diff --git a/dev/jobs/JGLOBAL_STAGE_IC b/dev/jobs/JGLOBAL_STAGE_IC index e62933f0a2..1b85aecd26 100755 --- a/dev/jobs/JGLOBAL_STAGE_IC +++ b/dev/jobs/JGLOBAL_STAGE_IC @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Setup Python path for pygfs PYTHONPATH="${HOMEglobal}/ush/python${PYTHONPATH:+:${PYTHONPATH}}" diff --git a/dev/jobs/JGLOBAL_WAVE_GEMPAK b/dev/jobs/JGLOBAL_WAVE_GEMPAK index 04913144a0..f897627a59 100755 --- a/dev/jobs/JGLOBAL_WAVE_GEMPAK +++ b/dev/jobs/JGLOBAL_WAVE_GEMPAK @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" source "${USHglobal}/wave_domain_grid.sh" ################################### diff --git a/dev/jobs/JGLOBAL_WAVE_INIT b/dev/jobs/JGLOBAL_WAVE_INIT index 246a362c99..8698264b03 100755 --- a/dev/jobs/JGLOBAL_WAVE_INIT +++ b/dev/jobs/JGLOBAL_WAVE_INIT @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export MP_PULSE=0 diff --git a/dev/jobs/JGLOBAL_WAVE_POST_BNDPNT b/dev/jobs/JGLOBAL_WAVE_POST_BNDPNT index e3c5df58a5..4e3825b22b 100755 --- a/dev/jobs/JGLOBAL_WAVE_POST_BNDPNT +++ b/dev/jobs/JGLOBAL_WAVE_POST_BNDPNT @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export MP_PULSE=0 diff --git a/dev/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL b/dev/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL index 0eba9e5c68..76c3d1bd79 100755 --- a/dev/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL +++ b/dev/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export COMPONENT="wave" diff --git a/dev/jobs/JGLOBAL_WAVE_POST_PNT b/dev/jobs/JGLOBAL_WAVE_POST_PNT index 95d33fbb9e..ce841239b6 100755 --- a/dev/jobs/JGLOBAL_WAVE_POST_PNT +++ b/dev/jobs/JGLOBAL_WAVE_POST_PNT @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" export MP_PULSE=0 diff --git a/dev/jobs/JGLOBAL_WAVE_POST_SBS b/dev/jobs/JGLOBAL_WAVE_POST_SBS index 4080d962ff..7f67cd8084 100755 --- a/dev/jobs/JGLOBAL_WAVE_POST_SBS +++ b/dev/jobs/JGLOBAL_WAVE_POST_SBS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" source "${USHglobal}/wave_domain_grid.sh" # Set COM Paths diff --git a/dev/jobs/JGLOBAL_WAVE_PRDGEN_BULLS b/dev/jobs/JGLOBAL_WAVE_PRDGEN_BULLS index 854331ad0b..aaedfff056 100755 --- a/dev/jobs/JGLOBAL_WAVE_PRDGEN_BULLS +++ b/dev/jobs/JGLOBAL_WAVE_PRDGEN_BULLS @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" ################################### # Set COM Paths diff --git a/dev/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED b/dev/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED index 993506b670..1ce1e0b1c5 100755 --- a/dev/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED +++ b/dev/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" source "${USHglobal}/wave_domain_grid.sh" ################################### diff --git a/dev/jobs/JGLOBAL_WAVE_PREP b/dev/jobs/JGLOBAL_WAVE_PREP index 9be4c1087a..4f9ea24558 100755 --- a/dev/jobs/JGLOBAL_WAVE_PREP +++ b/dev/jobs/JGLOBAL_WAVE_PREP @@ -10,6 +10,9 @@ source "${HOMEglobal}/ush/jjob_standard_vars.sh" #{% endif %} source "${USHglobal}/jjob_shell_setup.sh" +# Set strict mode which will exit on error or undefined variable +# and exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) +source "${USHglobal}/set_strict.sh" # Set rtofs PDY # shellcheck disable=SC2153 diff --git a/dev/scripts/exgdas_atmos_verfrad.sh b/dev/scripts/exgdas_atmos_verfrad.sh index 58684072a6..227bb9bc31 100755 --- a/dev/scripts/exgdas_atmos_verfrad.sh +++ b/dev/scripts/exgdas_atmos_verfrad.sh @@ -18,7 +18,7 @@ ################################################################################ # Do not exit on errors so that restricted data can be protected -unset_strict +source "${USHglobal}/unset_strict.sh" if [[ ! -s "${radstat}" || ! -s "${biascr}" ]]; then export err=1 diff --git a/dev/scripts/exglobal_atmos_products.sh b/dev/scripts/exglobal_atmos_products.sh index d7cbb026fc..63acc13594 100755 --- a/dev/scripts/exglobal_atmos_products.sh +++ b/dev/scripts/exglobal_atmos_products.sh @@ -90,10 +90,10 @@ for ((nset = 1; nset <= downset; nset++)); do # if final record of is u-component, add next record v-component # if final record is land, add next record icec # grep returns 1 if no match is found, so temporarily turn off exit on non-zero rc - unset_strict + source "${USHglobal}/unset_strict.sh" ${WGRIB2} -d "${last}" "${tmpfile}" | grep -E -i "ugrd|ustm|uflx|u-gwd|land|maxuw" rc=$? - set_strict + source "${USHglobal}/set_strict.sh" if [[ ${rc} == 0 ]]; then # Matched the grep last=$((last + 1)) fi diff --git a/ush/jjob_shell_setup.sh b/ush/jjob_shell_setup.sh index cb7f6d03fc..e2d0b5782f 100644 --- a/ush/jjob_shell_setup.sh +++ b/ush/jjob_shell_setup.sh @@ -7,7 +7,7 @@ # # Handles: # - Sourcing utility functions (wait_for_file, dataroot_com_path, timer, -# err_exit, set_strict, postamble) +# err_exit, postamble) # - Setting shell options (nullglob) # - Each utility script exports its own functions via declare -xf # - Activating strict mode (set -eu) and tracing (set -x) @@ -38,10 +38,8 @@ source "${USHglobal}/err_exit.sh" shopt -s nullglob # Allow null globs instead of treating * as literal ############################################## -# Shell options, strict mode, and tracing +# Shell options and tracing ############################################## -source "${USHglobal}/set_strict.sh" -source "${USHglobal}/unset_strict.sh" source "${USHglobal}/set_trace.sh" export SHELLOPTS ############################################## @@ -50,8 +48,7 @@ export SHELLOPTS source "${USHglobal}/setup_data_dir.sh" setup_data_dir "${DATA}" -# Activate strict mode and tracing -set_strict +# Activate tracing set_trace ############################################## @@ -65,7 +62,5 @@ trap "postamble ${start_time}" EXIT # Temporal variables: PDY, PDYm#, PDYp# (via setpdy.sh) ############################################## # setpdy.sh may not be available in all environments; failures are non-fatal -unset_strict setpdy.sh || true source ./PDY || true -set_strict diff --git a/ush/module-setup.sh b/ush/module-setup.sh index bb9b8a9c0e..1405b240ae 100755 --- a/ush/module-setup.sh +++ b/ush/module-setup.sh @@ -94,10 +94,4 @@ else echo WARNING: UNKNOWN PLATFORM 1>&2 fi -# If this function exists in the environment, run it; else do not -ftype=$(type -t set_strict || echo "") -if [[ "${ftype}" == "function" ]]; then - set_strict -else - set +u -fi +set +u diff --git a/ush/run_mpmd.sh b/ush/run_mpmd.sh index 461942c96e..9912a5aa7a 100755 --- a/ush/run_mpmd.sh +++ b/ush/run_mpmd.sh @@ -196,10 +196,10 @@ for ((i = 0; i < nm; i += chunk_size)); do # Count the number of lines not including commented lines (i.e. shebangs) n_mpmd_tasks=$(grep -v -c "^ *#" < "${chunk_file}") if [[ "${_mpmd_launcher}" == "srun" ]]; then - unset_strict + source "${USHglobal}/unset_strict.sh" # shellcheck disable=SC2086 ${launcher:-} ${mpmd_opt:-} -n "${n_mpmd_tasks}" "${chunk_file}" - set_strict + source "${USHglobal}/set_strict.sh" elif [[ "${_mpmd_launcher}" == "mpiexec" ]]; then # shellcheck disable=SC2086 ${launcher:-} -np "${n_mpmd_tasks}" ${mpmd_opt:-} "${chunk_file}" diff --git a/ush/set_strict.sh b/ush/set_strict.sh index 4d7316872d..553195967c 100644 --- a/ush/set_strict.sh +++ b/ush/set_strict.sh @@ -1,19 +1,12 @@ #! /usr/bin/env bash - ####### -# Defines the set_strict function for use in J-jobs and ex-scripts. -# -# Source this file to load the function into the current shell: +# Source this file to set strict mode in a script. # source "${USHglobal}/set_strict.sh" ####### -set_strict() { - if [[ ${STRICT:-"YES"} == "YES" ]]; then - # Exit on error or undefined variable - set -eu - # Exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) - set -o pipefail - fi -} - -declare -xf set_strict +if [[ ${STRICT:-"YES"} == "YES" ]]; then + # Exit on error or undefined variable + set -eu + # Exit on error in a pipeline (e.g. if a command in "cmd | cmd2" fails) + set -o pipefail +fi diff --git a/ush/syndat_getjtbul.sh b/ush/syndat_getjtbul.sh index 88d0868b15..6b80856604 100755 --- a/ush/syndat_getjtbul.sh +++ b/ush/syndat_getjtbul.sh @@ -102,9 +102,9 @@ fi pgm=$(basename "${EXECglobal}/syndat_getjtbul.x") export pgm if [[ -s prep_step ]]; then - unset_strict + source "${USHglobal}/unset_strict.sh" source prep_step - set_strict + source "${USHglobal}/set_strict.sh" else rm -f errfile #shellcheck disable=SC2046 diff --git a/ush/syndat_qctropcy.sh b/ush/syndat_qctropcy.sh index 2ec4562ff5..fa67611d08 100755 --- a/ush/syndat_qctropcy.sh +++ b/ush/syndat_qctropcy.sh @@ -206,9 +206,9 @@ cpreq "${slmask}" slmask.126 pgm=$(basename "${EXECglobal}/syndat_qctropcy.x") export pgm if [[ -s prep_step ]]; then - unset_strict + source "${USHglobal}/unset_strict.sh" source prep_step - set_strict + source "${USHglobal}/set_strict.sh" else rm -f errfile # shellcheck disable=SC2046 diff --git a/ush/unset_strict.sh b/ush/unset_strict.sh index 1cc7718e3c..48a1b57147 100644 --- a/ush/unset_strict.sh +++ b/ush/unset_strict.sh @@ -1,16 +1,9 @@ #! /usr/bin/env bash - ####### -# Defines the unset_strict function for use in J-jobs and ex-scripts. -# -# Source this file to load the function into the current shell: +# Source this file to unset strict mode in a script. # source "${USHglobal}/unset_strict.sh" ####### -unset_strict() { - # Turn off strict mode - set +eu - set +o pipefail -} - -declare -xf unset_strict +# Turn off strict mode +set +eu +set +o pipefail