Skip to content

Commit

Permalink
Check file or directory existence before attempting to prune (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTreadon-NOAA committed Aug 26, 2022
1 parent 955dae3 commit 36481a2
Showing 1 changed file with 56 additions and 40 deletions.
96 changes: 56 additions & 40 deletions ush/prune_4nco_global.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ echo " "
cd $topdir
rlist="regression src/GSD unit-tests"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -67,11 +69,13 @@ done
cd $topdir/doc
rlist="EnKF_user_guide GSI_user_guide README.discover Release_Notes.fv3gfs_da.v15.0.0.txt Release_Notes.gfsda.v16.0.0.txt"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -88,11 +92,13 @@ done
cd $topdir/jobs
rlist="JGDAS_EFSOI"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -109,11 +115,13 @@ done
cd $topdir/scripts
rlist="exurma2p5_gsianl.sh exgdas_efsoi"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -130,11 +138,13 @@ done
cd $topdir/ush
rlist="Get_Initial_Files comenkf comgsi gfs_truncate_enkf llsub para refactor_4nco_global run_arw rungsi sub"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ] ; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -151,11 +161,13 @@ done
cd $topdir/util
rlist="Aero Analysis_Utilities Baseline Config Conventional_Monitor Correlated_Obs DTC EFSOI Fit2Obs_Scorecard FOV GEN_BE_V2.0 GMI_BUFR MODIS_AOD Minimization_Monitor/data_xtrct Minimization_Monitor/image_gen Minimization_Monitor/nwprod/nam_minmon Misc NCEP NMC_Bkerror Ozone_Monitor/image_gen README Radar_Monitor Radiance_bias_correction_Utilities Radiance_Monitor/nwprod/nam_radmon Radiance_Utilities Single_Observation bufr_tools global_angupdate gsienvreport.sh python_utilities radar_process zero_biascoeff"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -172,11 +184,13 @@ done
cd $topdir/util/EnKF
rlist="arw python_utilities"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand All @@ -193,11 +207,13 @@ done
cd $topdir/util/EnKF/gfs/src
rlist="adjustps misc preproc gribmean recenterncio_hybgain recenternemsiop_hybgain getnstensmeanp adderrspec getsfcnstensupdp"
for type in $rlist; do
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
if [ -e $type ]; then
git $string ${type}*
rc=$?
if [[ $rc -ne 0 ]]; then
echo "***ERROR* git $string ${type}"
exit
fi
fi
if [[ "$mode" = "restore" ]]; then
git checkout ${type}*
Expand Down

0 comments on commit 36481a2

Please sign in to comment.