endCheckEmpty uses full DESCRIPTION as error message, if available
This commit is contained in:
@@ -128,14 +128,14 @@ echoerr() { >&2 echo "$@"; }
|
||||
# endCheckEmpty <VariableName> [DESCRIPTION]
|
||||
# DESCRIPTION : Optional text for error
|
||||
endCheckEmpty() {
|
||||
local errorText=$1
|
||||
eval 'local ref=$'$1
|
||||
|
||||
if [ ! -z "$2" ] ; then
|
||||
errorText=$2
|
||||
fi
|
||||
if [ -z $ref ] ; then
|
||||
echoerr -e " [E] $errorText must not be empty.\n Sequence stopped."
|
||||
if [ ! -z "$2" ] ; then
|
||||
echoerr -e " [E] $2\n Sequence stopped."
|
||||
else
|
||||
echoerr -e " [E] $1 must not be empty.\n Sequence stopped."
|
||||
fi
|
||||
exit 666
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user