Added warning report section to quit function

This commit is contained in:
Asif Bacchus 2018-09-19 23:22:57 -06:00
parent 83442bc6fb
commit ebb56aa098

View File

@ -25,6 +25,15 @@ function scriptHelp {
### quit -- exit the script after logging any errors, warnings, etc. and ### quit -- exit the script after logging any errors, warnings, etc. and
### cleaning up as necessary ### cleaning up as necessary
function quit { 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 if [ -z "$1" ]; then
# exit cleanly # exit cleanly
echo -e "${bold}${green}${stamp} -- [SUCCESS] Script completed" \ echo -e "${bold}${green}${stamp} -- [SUCCESS] Script completed" \