From ebb56aa098068ce6d9a76afd31b614355c661e3d Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 19 Sep 2018 23:22:57 -0600 Subject: [PATCH] Added warning report section to quit function --- backup.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backup.sh b/backup.sh index bc4224d..464ae1b 100755 --- a/backup.sh +++ b/backup.sh @@ -25,6 +25,15 @@ function scriptHelp { ### quit -- exit the script after logging any errors, warnings, etc. and ### cleaning up as necessary function quit { + # list generated warnings, if any + if [ ${#exitWarn[@]} -gt 0 ]; then + echo -e "${bold}${yellow}${stamp} Script generated the following" \ + "warnings:${normal}" >> "$logFile" + for warn in "${!exitWarn[@]}"; do + echo -e "${yellow}${warn}: ${warningExplain[$warn]}${normal}" \ + >> "$logFile" + done + fi if [ -z "$1" ]; then # exit cleanly echo -e "${bold}${green}${stamp} -- [SUCCESS] Script completed" \