Removed scriptHelp error code exit and removed error code 1
This commit is contained in:
parent
3581fd3bb5
commit
74a514feb8
@ -0,0 +1,4 @@
|
|||||||
|
[1m[31m[2018-09-19 15:51:58] -- [ERROR] Script exited with code 1 --[0m
|
||||||
|
[31mMissing or invalid parameters on script invocation.[0m
|
||||||
|
[1m[31m[2018-09-19 15:52:19] -- [ERROR] Script exited with code 1 --[0m
|
||||||
|
[31mMissing or invalid parameters on script invocation.[0m
|
10
backup.sh
10
backup.sh
@ -18,8 +18,8 @@ stamp="[`date +%Y-%m-%d` `date +%H:%M:%S`]"
|
|||||||
### scriptHelp -- display usage information for this script
|
### scriptHelp -- display usage information for this script
|
||||||
function scriptHelp {
|
function scriptHelp {
|
||||||
echo "In the future, I will be something helpful!"
|
echo "In the future, I will be something helpful!"
|
||||||
# exit with error code IF passed
|
# exit with code 98 -- there is no use logging this
|
||||||
quit $1
|
exit 98
|
||||||
}
|
}
|
||||||
|
|
||||||
### quit -- exit the script after logging any errors, warnings, etc. and
|
### quit -- exit the script after logging any errors, warnings, etc. and
|
||||||
@ -56,7 +56,7 @@ errorExplain=()
|
|||||||
|
|
||||||
|
|
||||||
### Error codes
|
### Error codes
|
||||||
errorExplain[1]="Missing or invalid parameters on script invocation."
|
|
||||||
|
|
||||||
|
|
||||||
### Process script parameters
|
### 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 no parameters provided, then show the help page and exit with error
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
# show script help page
|
# show script help page
|
||||||
scriptHelp 1
|
scriptHelp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# use GetOpts to process parameters
|
# use GetOpts to process parameters
|
||||||
@ -76,7 +76,7 @@ while getopts ':l:' PARAMS; do
|
|||||||
;;
|
;;
|
||||||
?)
|
?)
|
||||||
# unrecognized parameters trigger scriptHelp
|
# unrecognized parameters trigger scriptHelp
|
||||||
scriptHelp 1
|
scriptHelp
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user