diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-07-31 12:46:41 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-07-31 12:46:41 +0300 |
commit | 8ee6cb42a304e647060b7a8ee0103c1f43158b45 (patch) | |
tree | 56f29bab8ae38e7f2dfbec48404c86d416c7768c | |
parent | f436a59c5f5381709e15f0b6c13583a963be5965 (diff) |
DisplayError can now use an optional exit code to quit the program
-rw-r--r-- | include/functions | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/functions b/include/functions index f9e13c39..1f49fba0 100644 --- a/include/functions +++ b/include/functions @@ -533,13 +533,17 @@ # Name : DisplayError() # Description : Show error on screen # - # Input : $1 = text (string) + # Input : $1 = text (string), $2 = optional exit code (integer) # Returns : <nothing> ################################################################################ DisplayError() { + EXITCODE="" + if [ $# -gt 1 ]; then EXITCODE=$2; fi + ${ECHOCMD} "" ${ECHOCMD} "${WARNING}Error${NORMAL}: ${BOLD}$1${NORMAL}" ${ECHOCMD} "" + if [ ! -z "${EXITCODE}" ]; then ExitCustom ${EXITCODE}; fi } |