From 74a514feb874570ca87a292a6f263dd4c8d9963d Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 19 Sep 2018 15:57:06 -0600 Subject: [PATCH] Removed scriptHelp error code exit and removed error code 1 --- backup.log | 4 ++++ backup.sh | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backup.log b/backup.log index e69de29..32e9a9f 100644 --- a/backup.log +++ b/backup.log @@ -0,0 +1,4 @@ +[2018-09-19 15:51:58] -- [ERROR] Script exited with code 1 -- +Missing or invalid parameters on script invocation. +[2018-09-19 15:52:19] -- [ERROR] Script exited with code 1 -- +Missing or invalid parameters on script invocation. diff --git a/backup.sh b/backup.sh index 63cfd16..c139a68 100755 --- a/backup.sh +++ b/backup.sh @@ -18,8 +18,8 @@ stamp="[`date +%Y-%m-%d` `date +%H:%M:%S`]" ### scriptHelp -- display usage information for this script function scriptHelp { echo "In the future, I will be something helpful!" - # exit with error code IF passed - quit $1 + # exit with code 98 -- there is no use logging this + exit 98 } ### quit -- exit the script after logging any errors, warnings, etc. and @@ -56,7 +56,7 @@ errorExplain=() ### Error codes -errorExplain[1]="Missing or invalid parameters on script invocation." + ### Process script parameters @@ -64,7 +64,7 @@ errorExplain[1]="Missing or invalid parameters on script invocation." # if no parameters provided, then show the help page and exit with error if [ -z $1 ]; then # show script help page - scriptHelp 1 + scriptHelp fi # use GetOpts to process parameters @@ -76,7 +76,7 @@ while getopts ':l:' PARAMS; do ;; ?) # unrecognized parameters trigger scriptHelp - scriptHelp 1 + scriptHelp ;; esac done