From 78f64aac6aa23781a597cb74d96d5446d28964dd Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sat, 30 Mar 2013 12:53:19 -0400 Subject: [PATCH] added a tiny error flag test function. --- scripts/core/functions.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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")" -- 2.34.1