diff --git a/ush/ozn_xtrct.sh b/ush/ozn_xtrct.sh index 560f563d25..0ccdf4468c 100755 --- a/ush/ozn_xtrct.sh +++ b/ush/ozn_xtrct.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" #------------------------------------------------------------------ # ozn_xtrct.sh @@ -58,13 +58,13 @@ nregion=${nregion:-6} DO_DATA_RPT=${DO_DATA_RPT:-0} netcdf_boolean=".false." -if [[ $OZNMON_NETCDF -eq 1 ]]; then +if [[ ${OZNMON_NETCDF} -eq 1 ]]; then netcdf_boolean=".true." fi OZNMON_NEW_HDR=${OZNMON_NEW_HDR:-0} new_hdr="F" -if [[ $OZNMON_NEW_HDR -eq 1 ]]; then +if [[ ${OZNMON_NEW_HDR} -eq 1 ]]; then new_hdr="T" fi @@ -72,19 +72,19 @@ fi # if VALIDATE_DATA then locate and untar base file # validate=".FALSE." -if [[ $VALIDATE_DATA -eq 1 ]]; then - if [[ ! -e $ozn_val_file && ! -h $ozn_val_file ]]; then - echo "WARNING: VALIDATE_DATA set to 1, but unable to locate $ozn_val_file" +if [[ ${VALIDATE_DATA} -eq 1 ]]; then + if [[ ! -e ${ozn_val_file} && ! -h ${ozn_val_file} ]]; then + echo "WARNING: VALIDATE_DATA set to 1, but unable to locate ${ozn_val_file}" echo " Setting VALIDATE_DATA to 0/OFF" VALIDATE_DATA=0 else validate=".TRUE." val_file=$(basename "${ozn_val_file}") - ${NCP} "$ozn_val_file" "$val_file" - tar -xvf "$val_file" + ${NCP} "${ozn_val_file}" "${val_file}" + tar -xvf "${val_file}" fi fi -echo "VALIDATE_DATA, validate = $VALIDATE_DATA, $validate " +echo "VALIDATE_DATA, validate = ${VALIDATE_DATA}, ${validate} " @@ -149,9 +149,9 @@ else # for ptype in ${ozn_ptype}; do - iyy=$(echo "${PDY}" | cut -c1-4) - imm=$(echo "${PDY}" | cut -c5-6) - idd=$(echo "${PDY}" | cut -c7-8) + iyy="${PDY:0:4}" + imm="${PDY:4:2}" + idd="${PDY:6:2}" ihh=${cyc} for type in ${avail_satype}; do @@ -195,10 +195,10 @@ EOF if [[ ! -d ${TANKverf_ozn}/time ]]; then mkdir -p "${TANKverf_ozn}/time" fi - $NCP "${type}.${ptype}.ctl "${TANKverf_ozn}/time/" - $NCP "${type}.${ptype}.${PDY}${cyc}.ieee_d" "${TANKverf_ozn}/time/" + ${NCP} "${type}.${ptype}.ctl" "${TANKverf_ozn}/time/" + ${NCP} "${type}.${ptype}.${PDY}${cyc}.ieee_d" "${TANKverf_ozn}/time/" - $NCP bad* "${TANKverf_ozn}/time/" + ${NCP} bad* "${TANKverf_ozn}/time/" rm -f input @@ -226,10 +226,10 @@ EOF if [[ ! -d ${TANKverf_ozn}/horiz ]]; then mkdir -p "${TANKverf_ozn}/horiz" fi - $NCP "${type}.${ptype}.ctl" "${TANKverf_ozn}/horiz/" + ${NCP} "${type}.${ptype}.ctl" "${TANKverf_ozn}/horiz/" - $COMPRESS "${type}.${ptype}.${PDY}${cyc}.ieee_d" - $NCP "${type}.${ptype}.${PDY}${cyc}.ieee_d.${Z}" "${TANKverf_ozn}/horiz/" + ${COMPRESS} "${type}.${ptype}.${PDY}${cyc}.ieee_d" + ${NCP} "${type}.${ptype}.${PDY}${cyc}.ieee_d.${Z}" "${TANKverf_ozn}/horiz/" echo "finished processing ptype, type: ${ptype}, ${type}" diff --git a/ush/radmon_diag_ck.sh b/ush/radmon_diag_ck.sh index 4045ddb2d5..3a9d3618e7 100755 --- a/ush/radmon_diag_ck.sh +++ b/ush/radmon_diag_ck.sh @@ -27,7 +27,7 @@ echo "--> radmon_diag_ck.sh" # Process input arguments # nargs=$# - if [[ $nargs -ne 6 ]]; then + if [[ ${nargs} -ne 6 ]]; then usage exit 1 fi @@ -35,9 +35,9 @@ echo "--> radmon_diag_ck.sh" while [[ $# -ge 1 ]] do key="$1" - echo $key + echo "${key}" - case $key in + case ${key} in -r|--rad) radstat_file="$2" shift # past argument @@ -52,7 +52,7 @@ echo "--> radmon_diag_ck.sh" ;; *) #unspecified key - echo " unsupported key = $key" + echo " unsupported key = ${key}" ;; esac @@ -71,7 +71,7 @@ echo "--> radmon_diag_ck.sh" #--------------------------------------------- # get list of diag files in the radstat file # - radstat_contents=`tar -tf ${radstat_file} | grep '_ges' | + radstat_contents=`tar -tf "${radstat_file}" | grep '_ges' | gawk -F"diag_" '{print $2}' | gawk -F"_ges" '{print $1}'` @@ -79,15 +79,15 @@ echo "--> radmon_diag_ck.sh" #--------------------------------------------- # load contents of satype_file into an array # - satype_contents=`cat ${satype_file}` + satype_contents=`cat "${satype_file}"` #------------------------------------------------- # compare $satype_contents and $radstat_contents # report anything missing # - for sat in $satype_contents; do - test=`echo $radstat_contents | grep $sat` + for sat in ${satype_contents}; do + test=`echo "${radstat_contents}" | grep "${sat}"` if [[ ${#test} -le 0 ]]; then missing_diag="${missing_diag} ${sat}" @@ -117,10 +117,10 @@ echo "--> radmon_diag_ck.sh" # TODO Rewrite these array parsing commands to avoid using Bash's sloppy word splitting # File sizes contain only digits and immediately precede the date # shellcheck disable=SC2207 - sizes=($(tar -vtf ${radstat_file} --wildcards '*_ges*' | grep -P -o '(\d)+(?= \d{4}-\d{2}-\d{2})')) + sizes=($(tar -vtf "${radstat_file}" --wildcards '*_ges*' | grep -P -o '(\d)+(?= \d{4}-\d{2}-\d{2})')) # Filenames are the last group of non-whitespace characters # shellcheck disable=SC2207 - filenames=($(tar -vtf ${radstat_file} --wildcards '*_ges*' | grep -P -o '\S+$')) + filenames=($(tar -vtf "${radstat_file}" --wildcards '*_ges*' | grep -P -o '\S+$')) # shellcheck disable= @@ -144,7 +144,7 @@ echo "--> radmon_diag_ck.sh" zero_len_diag="${zero_len_diag} ${sat}" fi - rm -f ${uz_file_name} + rm -f "${uz_file_name}" fi done @@ -159,13 +159,13 @@ echo "--> radmon_diag_ck.sh" # if [[ ${#zero_len_diag} -gt 0 ]]; then for zld in ${zero_len_diag}; do - echo " Zero Length diagnostic file: $zld" >> $output_file + echo " Zero Length diagnostic file: ${zld}" >> "${output_file}" done fi if [[ ${#missing_diag} -gt 0 ]]; then for md in ${missing_diag}; do - echo " Missing diagnostic file : $md" >> $output_file + echo " Missing diagnostic file : ${md}" >> "${output_file}" done fi diff --git a/ush/radmon_err_rpt.sh b/ush/radmon_err_rpt.sh index 8561563d48..39085b1de3 100755 --- a/ush/radmon_err_rpt.sh +++ b/ush/radmon_err_rpt.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" ################################################################################ #### UNIX Script Documentation Block @@ -63,12 +63,12 @@ err=0 RADMON_SUFFIX=${RADMON_SUFFIX} have_diag_rpt=0 -if [[ -s $diag_rpt ]]; then +if [[ -s ${diag_rpt} ]]; then have_diag_rpt=1 else err=1 fi -echo "have_diag_rpt = $have_diag_rpt" +echo "have_diag_rpt = ${have_diag_rpt}" #----------------------------------------------------------------------------- # read each line in the $file1 @@ -76,15 +76,15 @@ echo "have_diag_rpt = $have_diag_rpt" # if same combination is in both files, add the values to the output file # { while read myline; do - echo "myline = $myline" + echo "myline = ${myline}" bound="" - echo $myline - satname=$(echo $myline | gawk '{print $1}') - channel=$(echo $myline | gawk '{print $3}') - region=$(echo $myline | gawk '{print $5}') - value1=$(echo $myline | gawk '{print $7}') - bound=$(echo $myline | gawk '{print $9}') + echo "${myline}" + satname=$(echo "${myline}" | gawk '{print $1}') + channel=$(echo "${myline}" | gawk '{print $3}') + region=$(echo "${myline}" | gawk '{print $5}') + value1=$(echo "${myline}" | gawk '{print $7}') + bound=$(echo "${myline}" | gawk '{print $9}') # # Check findings against diag_report. If the satellite/instrument is on the @@ -96,40 +96,40 @@ echo "have_diag_rpt = $have_diag_rpt" diag_match="" diag_match_len=0 - if [[ $have_diag_rpt == 1 ]]; then - diag_match=$(gawk "/$satname/" $diag_rpt) + if [[ ${have_diag_rpt} == 1 ]]; then + diag_match=$(gawk "/${satname}/" "${diag_rpt}") diag_match_len=$(echo ${#diag_match}) fi - if [[ $diag_match_len == 0 ]]; then + if [[ ${diag_match_len} == 0 ]]; then - if [[ $type == "chan" ]]; then - echo "looking for match for $satname and $channel" + if [[ ${type} == "chan" ]]; then + echo "looking for match for ${satname} and ${channel}" { while read myline2; do - satname2=$(echo $myline2 | gawk '{print $1}') - channel2=$(echo $myline2 | gawk '{print $3}') + satname2=$(echo "${myline2}" | gawk '{print $1}') + channel2=$(echo "${myline2}" | gawk '{print $3}') - if [[ $satname == $satname2 && $channel == $channel2 ]]; then - match="$satname channel= $channel" - echo "match from gawk = $match" + if [[ ${satname} == ${satname2} && ${channel} == ${channel2} ]]; then + match="${satname} channel= ${channel}" + echo "match from gawk = ${match}" break; else match="" fi - done } < $file2 + done } < "${file2}" else - match=$(gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2) - echo match = $match + match=$(gawk "/${satname}/ && /channel= ${channel} / && /region= ${region} /" "${file2}") + echo match = "${match}" match_len=$(echo ${#match}) - if [[ $match_len > 0 ]]; then - channel2=$(echo $match | gawk '{print $3}') + if [[ ${match_len} > 0 ]]; then + channel2=$(echo "${match}" | gawk '{print $3}') - if [[ $channel2 != $channel ]]; then + if [[ ${channel2} != ${channel} ]]; then match="" fi fi @@ -137,54 +137,54 @@ echo "have_diag_rpt = $have_diag_rpt" fi match_len=$(echo ${#match}) - if [[ $match_len > 0 ]]; then + if [[ ${match_len} > 0 ]]; then - value2=$(echo $match | gawk '{print $7}') - bound2=$(echo $match | gawk '{print $9}') + value2=$(echo "${match}" | gawk '{print $7}') + bound2=$(echo "${match}" | gawk '{print $9}') - if [[ $type == "chan" ]]; then - tmpa=" $satname channel= $channel" + if [[ ${type} == "chan" ]]; then + tmpa=" ${satname} channel= ${channel}" tmpb="" - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" + elif [[ ${type} == "pen" ]]; then + tmpa="${satname} channel= ${channel} region= ${region}" + tmpb="${cycle1} ${value1} ${bound}" - elif [[ $type == "cnt" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" + elif [[ ${type} == "cnt" ]]; then + tmpa="${satname} channel= ${channel} region= ${region}" + tmpb="${cycle1} ${value1} ${bound}" else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" + tmpa="${satname} channel= ${channel} region= ${region}" + tmpb="${cycle1}: ${type}= ${value1}" fi - line1="$tmpa $tmpb" - echo "$line1" >> $outfile + line1="${tmpa} ${tmpb}" + echo "${line1}" >> "${outfile}" - if [[ $type != "chan" ]]; then - tmpc=$(echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g') + if [[ ${type} != "chan" ]]; then + tmpc=$(echo "${tmpa}" |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g') - if [[ $type == "pen" || $type == "cnt" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" + if [[ ${type} == "pen" || ${type} == "cnt" ]]; then + line2=" ${tmpc} ${cycle2} ${value2} ${bound2}" else - line2=" $tmpc $cycle2: $type= $value2" + line2=" ${tmpc} ${cycle2}: ${type}= ${value2}" fi - echo "$line2" >> $outfile + echo "${line2}" >> "${outfile}" fi #----------------------------------------- # add hyperlink to warning entry # line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/es_rad/${RADMON_SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${channel}&stat=${type}" - if [[ $channel -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile + if [[ ${channel} -gt 0 ]]; then + echo "${line3}" >> "${outfile}" + echo "" >> "${outfile}" fi fi fi -done } < $file1 +done } < "${file1}" ################################################################################ diff --git a/ush/radmon_verf_angle.sh b/ush/radmon_verf_angle.sh index 133cec023a..a8d8da4637 100755 --- a/ush/radmon_verf_angle.sh +++ b/ush/radmon_verf_angle.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" ################################################################################ #### UNIX Script Documentation Block @@ -72,19 +72,19 @@ REGIONAL_RR=${REGIONAL_RR:-0} # rapid refresh model flag rgnHH=${rgnHH:-} rgnTM=${rgnTM:-} -echo " REGIONAL_RR, rgnHH, rgnTM = $REGIONAL_RR, $rgnHH, $rgnTM" +echo " REGIONAL_RR, rgnHH, rgnTM = ${REGIONAL_RR}, ${rgnHH}, ${rgnTM}" netcdf_boolean=".false." -if [[ $RADMON_NETCDF -eq 1 ]]; then +if [[ ${RADMON_NETCDF} -eq 1 ]]; then netcdf_boolean=".true." fi -echo " RADMON_NETCDF, netcdf_boolean = ${RADMON_NETCDF}, $netcdf_boolean" +echo " RADMON_NETCDF, netcdf_boolean = ${RADMON_NETCDF}, ${netcdf_boolean}" which prep_step which startmsg # File names export pgmout=${pgmout:-${jlogfile}} -touch $pgmout +touch "${pgmout}" # Other variables SATYPE=${SATYPE:-} @@ -93,7 +93,7 @@ LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} USE_ANL=${USE_ANL:-0} -if [[ $USE_ANL -eq 1 ]]; then +if [[ ${USE_ANL} -eq 1 ]]; then gesanl="ges anl" else gesanl="ges" @@ -107,8 +107,8 @@ scaninfo=scaninfo.txt #-------------------------------------------------------------------- # Copy extraction program and supporting files to working directory -$NCP ${EXECgfs}/${angle_exec} ./ -$NCP $shared_scaninfo ./${scaninfo} +${NCP} "${EXECgfs}/${angle_exec}" ./ +${NCP} "${shared_scaninfo}" ./${scaninfo} if [[ ! -s ./${angle_exec} || ! -s ./${scaninfo} ]]; then err=2 @@ -136,13 +136,13 @@ else for dtype in ${gesanl}; do - echo "pgm = $pgm" - echo "pgmout = $pgmout" + echo "pgm = ${pgm}" + echo "pgmout = ${pgmout}" prep_step - ctr=$(expr $ctr + 1) + ctr=$(expr ${ctr} + 1) - if [[ $dtype == "anl" ]]; then + if [[ ${dtype} == "anl" ]]; then data_file=${type}_anl.${PDY}${cyc}.ieee_d ctl_file=${type}_anl.ctl angl_ctl=angle.${ctl_file} @@ -153,7 +153,7 @@ else fi angl_file="" - if [[ $REGIONAL_RR -eq 1 ]]; then + if [[ ${REGIONAL_RR} -eq 1 ]]; then angl_file=${rgnHH}.${data_file}.${rgnTM} fi @@ -180,18 +180,18 @@ cat << EOF > input EOF startmsg - ./${angle_exec} < input >> ${pgmout} 2>>errfile + ./${angle_exec} < input >> "${pgmout}" 2>>errfile export err=$?; err_chk - if [[ $err -ne 0 ]]; then - fail=$(expr $fail + 1) + if [[ ${err} -ne 0 ]]; then + fail=$(expr ${fail} + 1) fi if [[ -s ${angl_file} ]]; then - ${COMPRESS} -f ${angl_file} + ${COMPRESS} -f "${angl_file}" fi if [[ -s ${angl_ctl} ]]; then - ${COMPRESS} -f ${angl_ctl} + ${COMPRESS} -f "${angl_ctl}" fi @@ -200,24 +200,24 @@ EOF done # for type in ${SATYPE} loop - ${USHgfs}/rstprod.sh + "${USHgfs}"/rstprod.sh tar_file=radmon_angle.tar if compgen -G "angle*.ieee_d*" > /dev/null || compgen -G "angle*.ctl*" > /dev/null; then - tar -cf $tar_file angle*.ieee_d* angle*.ctl* + tar -cf ${tar_file} angle*.ieee_d* angle*.ctl* ${COMPRESS} ${tar_file} - mv $tar_file.${Z} ${TANKverf_rad}/. + mv "${tar_file}.${Z}" "${TANKverf_rad}/." - if [[ $RAD_AREA = "rgn" ]]; then + if [[ ${RAD_AREA} = "rgn" ]]; then cwd=$(pwd) - cd ${TANKverf_rad} - tar -xf ${tar_file}.${Z} - rm ${tar_file}.${Z} - cd ${cwd} + cd "${TANKverf_rad}" + tar -xf "${tar_file}.${Z}" + rm "${tar_file}.${Z}" + cd "${cwd}" fi fi - if [[ $ctr -gt 0 && $fail -eq $ctr || $fail -gt $ctr ]]; then + if [[ ${ctr} -gt 0 && ${fail} -eq ${ctr} || ${fail} -gt ${ctr} ]]; then err=3 fi fi diff --git a/ush/radmon_verf_bcoef.sh b/ush/radmon_verf_bcoef.sh index 4485f81786..6e8c5fb5d7 100755 --- a/ush/radmon_verf_bcoef.sh +++ b/ush/radmon_verf_bcoef.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" ################################################################################ #### UNIX Script Documentation Block @@ -63,14 +63,14 @@ source "$HOMEgfs/ush/preamble.sh" #################################################################### netcdf_boolean=".false." -if [[ $RADMON_NETCDF -eq 1 ]]; then +if [[ ${RADMON_NETCDF} -eq 1 ]]; then netcdf_boolean=".true." fi -echo " RADMON_NETCDF, netcdf_boolean = ${RADMON_NETCDF}, $netcdf_boolean" +echo " RADMON_NETCDF, netcdf_boolean = ${RADMON_NETCDF}, ${netcdf_boolean}" # File names pgmout=${pgmout:-${jlogfile}} -touch $pgmout +touch "${pgmout}" # Other variables RAD_AREA=${RAD_AREA:-glb} @@ -85,7 +85,7 @@ USE_ANL=${USE_ANL:-0} err=0 bcoef_exec=radmon_bcoef.x -if [[ $USE_ANL -eq 1 ]]; then +if [[ ${USE_ANL} -eq 1 ]]; then gesanl="ges anl" else gesanl="ges" @@ -94,8 +94,8 @@ fi #-------------------------------------------------------------------- # Copy extraction program and supporting files to working directory -$NCP $EXECgfs/${bcoef_exec} ./${bcoef_exec} -$NCP ${biascr} ./biascr.txt +${NCP} "${EXECgfs}/${bcoef_exec}" ./${bcoef_exec} +${NCP} "${biascr}" ./biascr.txt if [[ ! -s ./${bcoef_exec} || ! -s ./biascr.txt ]]; then err=4 @@ -107,9 +107,9 @@ else export pgm=${bcoef_exec} - iyy=$(echo ${PDY} | cut -c1-4) - imm=$(echo ${PDY} | cut -c5-6) - idd=$(echo ${PDY} | cut -c7-8) + iyy="${PDY:0:4}" + imm="${PDY:4:2}" + idd="${PDY:6:2}" ihh=${cyc} ctr=0 @@ -129,9 +129,9 @@ else prep_step - ctr=$(expr $ctr + 1) + ctr=$(expr ${ctr} + 1) - if [[ $dtype == "anl" ]]; then + if [[ ${dtype} == "anl" ]]; then data_file=${type}_anl.${PDY}${cyc}.ieee_d ctl_file=${type}_anl.ctl bcoef_ctl=bcoef.${ctl_file} @@ -141,7 +141,7 @@ else bcoef_ctl=bcoef.${ctl_file} fi - if [[ $REGIONAL_RR -eq 1 ]]; then + if [[ ${REGIONAL_RR} -eq 1 ]]; then bcoef_file=${rgnHH}.bcoef.${data_file}.${rgnTM} else bcoef_file=bcoef.${data_file} @@ -169,10 +169,10 @@ cat << EOF > input / EOF startmsg - ./${bcoef_exec} < input >>${pgmout} 2>>errfile + ./${bcoef_exec} < input >>"${pgmout}" 2>>errfile export err=$?; err_chk - if [[ $err -ne 0 ]]; then - fail=$(expr $fail + 1) + if [[ ${err} -ne 0 ]]; then + fail=$(expr ${fail} + 1) fi @@ -181,11 +181,11 @@ EOF # if [[ -s ${bcoef_file} ]]; then - ${COMPRESS} ${bcoef_file} + ${COMPRESS} "${bcoef_file}" fi if [[ -s ${bcoef_ctl} ]]; then - ${COMPRESS} ${bcoef_ctl} + ${COMPRESS} "${bcoef_ctl}" fi @@ -193,24 +193,24 @@ EOF done # type in $SATYPE loop - ${USHgfs}/rstprod.sh + "${USHgfs}/rstprod.sh" if compgen -G "bcoef*.ieee_d*" > /dev/null || compgen -G "bcoef*.ctl*" > /dev/null; then tar_file=radmon_bcoef.tar - tar -cf $tar_file bcoef*.ieee_d* bcoef*.ctl* + tar -cf ${tar_file} bcoef*.ieee_d* bcoef*.ctl* ${COMPRESS} ${tar_file} - mv $tar_file.${Z} ${TANKverf_rad} + mv "${tar_file}.${Z}" "${TANKverf_rad}" - if [[ $RAD_AREA = "rgn" ]]; then + if [[ ${RAD_AREA} = "rgn" ]]; then cwd=$(pwd) - cd ${TANKverf_rad} - tar -xf ${tar_file}.${Z} - rm ${tar_file}.${Z} - cd ${cwd} + cd "${TANKverf_rad}" + tar -xf "${tar_file}.${Z}" + rm "${tar_file}.${Z}" + cd "${cwd}" fi fi - if [[ $ctr -gt 0 && $fail -eq $ctr || $fail -gt $ctr ]]; then + if [[ ${ctr} -gt 0 && ${fail} -eq ${ctr} || ${fail} -gt ${ctr} ]]; then err=5 fi fi diff --git a/ush/radmon_verf_bcor.sh b/ush/radmon_verf_bcor.sh index 5b89e59ed9..73042755a3 100755 --- a/ush/radmon_verf_bcor.sh +++ b/ush/radmon_verf_bcor.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" ################################################################################ #### UNIX Script Documentation Block @@ -66,7 +66,7 @@ source "$HOMEgfs/ush/preamble.sh" # File names pgmout=${pgmout:-${jlogfile}} -touch $pgmout +touch "${pgmout}" # Other variables RAD_AREA=${RAD_AREA:-glb} @@ -78,11 +78,11 @@ bcor_exec=radmon_bcor.x err=0 netcdf_boolean=".false." -if [[ $RADMON_NETCDF -eq 1 ]]; then +if [[ ${RADMON_NETCDF} -eq 1 ]]; then netcdf_boolean=".true." fi -if [[ $USE_ANL -eq 1 ]]; then +if [[ ${USE_ANL} -eq 1 ]]; then gesanl="ges anl" else gesanl="ges" @@ -92,7 +92,7 @@ fi #-------------------------------------------------------------------- # Copy extraction program to working directory -$NCP ${EXECgfs}/${bcor_exec} ./${bcor_exec} +${NCP} "${EXECgfs}/${bcor_exec}" ./${bcor_exec} if [[ ! -s ./${bcor_exec} ]]; then err=6 @@ -119,9 +119,9 @@ else prep_step - ctr=$(expr $ctr + 1) + ctr=$(expr ${ctr} + 1) - if [[ $dtype == "anl" ]]; then + if [[ ${dtype} == "anl" ]]; then data_file=${type}_anl.${PDY}${cyc}.ieee_d bcor_file=bcor.${data_file} ctl_file=${type}_anl.ctl @@ -144,7 +144,7 @@ else # Check for 0 length input file here and avoid running # the executable if $input_file doesn't exist or is 0 bytes # - if [[ -s $input_file ]]; then + if [[ -s ${input_file} ]]; then nchanl=-999 cat << EOF > input @@ -166,10 +166,10 @@ cat << EOF > input EOF startmsg - ./${bcor_exec} < input >> ${pgmout} 2>>errfile + ./${bcor_exec} < input >> "${pgmout}" 2>>errfile export err=$?; err_chk if [[ $? -ne 0 ]]; then - fail=$(expr $fail + 1) + fail=$(expr ${fail} + 1) fi @@ -178,11 +178,11 @@ EOF # if [[ -s ${bcor_file} ]]; then - ${COMPRESS} ${bcor_file} + ${COMPRESS} "${bcor_file}" fi if [[ -s ${bcor_ctl} ]]; then - ${COMPRESS} ${bcor_ctl} + ${COMPRESS} "${bcor_ctl}" fi fi @@ -190,24 +190,24 @@ EOF done # type in $SATYPE loop - ${USHgfs}/rstprod.sh + "${USHgfs}/rstprod.sh" tar_file=radmon_bcor.tar if compgen -G "bcor*.ieee_d*" > /dev/null || compgen -G "bcor*.ctl*" > /dev/null; then - tar -cf $tar_file bcor*.ieee_d* bcor*.ctl* + tar -cf ${tar_file} bcor*.ieee_d* bcor*.ctl* ${COMPRESS} ${tar_file} - mv $tar_file.${Z} ${TANKverf_rad}/. + mv "${tar_file}.${Z}" "${TANKverf_rad}/." - if [[ $RAD_AREA = "rgn" ]]; then + if [[ ${RAD_AREA} = "rgn" ]]; then cwd=$(pwd) - cd ${TANKverf_rad} - tar -xf ${tar_file}.${Z} - rm ${tar_file}.${Z} - cd ${cwd} + cd "${TANKverf_rad}" + tar -xf "${tar_file}.${Z}" + rm "${tar_file}.${Z}" + cd "${cwd}" fi fi - if [[ $ctr -gt 0 && $fail -eq $ctr || $fail -gt $ctr ]]; then + if [[ ${ctr} -gt 0 && ${fail} -eq ${ctr} || ${fail} -gt ${ctr} ]]; then err=7 fi fi