From: Chris Koeritz Date: Sat, 30 Mar 2013 16:53:19 +0000 (-0400) Subject: added a tiny error flag test function. X-Git-Tag: 2.140.90~1031 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=78f64aac6aa23781a597cb74d96d5446d28964dd;p=feisty_meow.git added a tiny error flag test function. --- diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index ae3fd1c1..9674e3b3 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -32,7 +32,18 @@ if [ -z "$skip_all" ]; then if [ ! -d "$1" ]; then mkdir -p "$1"; fi cd "$1" } - + + # checks the result of the last command that was run, and if it failed, + # then this complains and exits from bash. the function parameters are + # used as the message to print as a complaint. + function check_result() + { + if [ $? -ne 0 ]; then + echo -e "failed on: $*" + exit 1 + fi + } + # locates a process given a search pattern to match in the process list. function psfind() { local PID_DUMP="$(mktemp "$TMP/zz_pidlist.XXXXXX")"