Skip to content

Commit

Permalink
Update env files for shellcheck SC2166 and more SC2292
Browse files Browse the repository at this point in the history
- SC2166 (warning): Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
- SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
- Change "-o" to "||" and "-a" to "&&".
- Also apply more SC2292 double brace updates to lines that had SC2166 updates.

Refs NOAA-EMC#397
  • Loading branch information
KateFriedman-NOAA committed Nov 18, 2022
1 parent 9dd25de commit 2ae6b6b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export job=${PBS_JOBNAME:-${step}}
export jobid=${job}.${PBS_JOBID:-$$}


if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then

nth_max=$((${npe_node_max} / ${npe_node_prep}))

Expand All @@ -46,7 +46,7 @@ if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
export sys_tp="HERA"
export launcher_PREP="srun"

elif [ "${step}" = "waveinit" -o "${step}" = "waveprep" -o "${step}" = "wavepostsbs" -o "${step}" = "wavepostbndpnt" -o "${step}" = "wavepostbndpntbll" -o "${step}" = "wavepostpnt" ]; then
elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
Expand Down Expand Up @@ -87,7 +87,7 @@ elif [[ "${step}" = "aeroanlrun" ]]; then
[[ ${NTHREADS_AEROANL} -gt ${nth_max} ]] && export NTHREADS_AEROANL=${nth_max}
export APRUN_AEROANL="${launcher} -n ${npe_aeroanlrun}"

elif [ "${step}" = "anal" -o "${step}" = "analcalc" ]; then
elif [[ "${step}" = "anal" ]] || [[ "${step}" = "analcalc" ]]; then

export MKL_NUM_THREADS=4
export MKL_CBWR=AUTO
Expand Down
4 changes: 2 additions & 2 deletions env/JET.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ ulimit -a
export job=${PBS_JOBNAME:-${step}}
export jobid=${job}.${PBS_JOBID:-$$}

if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then

nth_max=$((${npe_node_max} / ${npe_node_prep}))

export POE="NO"
export BACK=${BACK:-"NO"}
export sys_tp="JET"

elif [ "${step}" = "waveinit" -o "${step}" = "waveprep" -o "${step}" = "wavepostsbs" -o "${step}" = "wavepostbndpnt" -o "${step}" = "wavepostbndpntbll" -o "${step}" = "wavepostpnt" ]; then
elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
Expand Down
6 changes: 3 additions & 3 deletions env/ORION.env
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ulimit -a
export job=${PBS_JOBNAME:-${step}}
export jobid=${job}.${PBS_JOBID:-$$}

if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then

nth_max=$((${npe_node_max} / ${npe_node_prep}))

Expand All @@ -45,7 +45,7 @@ if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
export sys_tp="ORION"
export launcher_PREP="srun"

elif [ "${step}" = "waveinit" -o "${step}" = "waveprep" -o "${step}" = "wavepostsbs" -o "${step}" = "wavepostbndpnt" -o "${step}" = "wavepostpnt" ]; then
elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
Expand Down Expand Up @@ -86,7 +86,7 @@ elif [[ "${step}" = "aeroanlrun" ]]; then
[[ ${NTHREADS_AEROANL} -gt ${nth_max} ]] && export NTHREADS_AEROANL=${nth_max}
export APRUN_AEROANL="${launcher} -n ${npe_aeroanlrun}"

elif [ "${step}" = "anal" -o "${step}" = "analcalc" ]; then
elif [[ "${step}" = "anal" ]] || [[ "${step}" = "analcalc" ]]; then

export MKL_NUM_THREADS=4
export MKL_CBWR=AUTO
Expand Down
10 changes: 5 additions & 5 deletions env/WCOSS2.env
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export npe_node_max=128
export job=${PBS_JOBNAME:-${step}}
export jobid=${job}.${PBS_JOBID:-$$}

if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then

nth_max=$((${npe_node_max} / ${npe_node_prep}))

Expand All @@ -33,9 +33,9 @@ if [ "${step}" = "prep" -o "${step}" = "prepbufr" ]; then
export sys_tp="wcoss2"
export launcher_PREP="mpiexec"

elif [ "${step}" = "waveinit" -o "${step}" = "waveprep" -o "${step}" = "wavepostsbs" -o "${step}" = "wavepostbndpnt" -o "${step}" = "wavepostbndpntbll" -o "${step}" = "wavepostpnt" ]; then
elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

if [ "${step}" = "waveprep" -a "${CDUMP}" = "gfs" ]; then NTASKS=${NTASKS_gfs} ; fi
if [[ "${step}" = "waveprep" ]] && [[ "${CDUMP}" = "gfs" ]]; then NTASKS=${NTASKS_gfs} ; fi
export wavempexec="${launcher} -np"
export wave_mpmd=${mpmd_opt}

Expand Down Expand Up @@ -73,7 +73,7 @@ elif [[ "${step}" = "aeroanlrun" ]]; then
[[ ${NTHREADS_AEROANL} -gt ${nth_max} ]] && export NTHREADS_AEROANL=${nth_max}
export APRUN_AEROANL="${launcher} -n ${npe_aeroanlrun}"

elif [ "${step}" = "anal" -o "${step}" = "analcalc" ]; then
elif [[ "${step}" = "anal" ]] || [[ "${step}" = "analcalc" ]]; then

export OMP_PLACES=cores
export OMP_STACKSIZE=1G
Expand Down Expand Up @@ -312,7 +312,7 @@ elif [[ "${step}" = "waveawipsbulls" ]]; then

unset PERL5LIB

elif [ "${step}" = "wafsgrib2" -o "${step}" = "wafsgrib20p25" ]; then
elif [[ "${step}" = "wafsgrib2" ]] || [[ "${step}" = "wafsgrib20p25" ]]; then

export USE_CFP=${USE_CFP:-"YES"}

Expand Down

0 comments on commit 2ae6b6b

Please sign in to comment.