From 65cebd484510a5e6fbc3f6033d9d0e87668df3fe Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 15 Sep 2020 23:20:05 -0600 Subject: [PATCH] display failures iff greater than 0 --- ab-openldap/ab-openldap-update.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ab-openldap/ab-openldap-update.sh b/ab-openldap/ab-openldap-update.sh index 50511d0..f0f4f51 100755 --- a/ab-openldap/ab-openldap-update.sh +++ b/ab-openldap/ab-openldap-update.sh @@ -155,7 +155,18 @@ done ### display results printf "\n%sResults:%s\n" "$cyan" "$norm" printf "\tUpdates: %s available\n" "$updatesAvailable" -printf "\tDownloads: %s successful, %s%s failed%s\n" "$downloadSuccess" "$err" "$downloadFailed" "$norm" -printf "\tUpdates: %s applied, %s%s failed%s\n\n" "$updateSuccess" "$err" "$updateFailed" "$norm" +if [ "$updatesAvailable" -gt '0' ]; then + if [ "$downloadFailed" -gt '0' ]; then + printf "\tDownloads: %s successful, %s%s failed%s\n" "$downloadSuccess" "$err" "$downloadFailed" "$norm" + else + printf "\tDownloads: %s successful\n" "$downloadSuccess" + fi + if [ "$updateFailed" -gt '0' ]; then + printf "\tUpdates: %s applied, %s%s failed%s\n\n" "$updateSuccess" "$err" "$updateFailed" "$norm" + else + printf "\tUpdates: %s applied\n\n" "$updateSuccess" + fi +fi +exit 0 -exit 0 \ No newline at end of file +#EOF \ No newline at end of file