aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts/function.sh
diff options
context:
space:
mode:
authorReto Buerki <reet@codelabs.ch>2012-12-06 17:00:15 +0100
committerTobias Brunner <tobias@strongswan.org>2013-01-17 15:22:10 +0100
commitfb2aab414af644a73e0dcca99215fa18f57a503f (patch)
tree8e37889eda66f298aede3a9d54a7b89e6428b8b9 /testing/scripts/function.sh
parentb86866579ab3054a21120bca00b4bdfe8c8e575d (diff)
downloadstrongswan-fb2aab414af644a73e0dcca99215fa18f57a503f.tar.bz2
strongswan-fb2aab414af644a73e0dcca99215fa18f57a503f.tar.xz
Use red color in die() function
This is the function where red color SHOULD be used.
Diffstat (limited to 'testing/scripts/function.sh')
-rwxr-xr-xtesting/scripts/function.sh18
1 files changed, 7 insertions, 11 deletions
diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh
index 4ee9b24b8..a04490aec 100755
--- a/testing/scripts/function.sh
+++ b/testing/scripts/function.sh
@@ -41,6 +41,9 @@ execute_chroot()
}
export TERM=xterm
+RED=$(tput setaf 1)
+GREEN=$(tput setaf 2)
+NORMAL=$(tput op)
function cecho {
echo -e "\033[1;31m$1\033[0m"
@@ -64,10 +67,6 @@ log_action()
# $1 - exit status of action
log_status()
{
- RED=$(tput setaf 1)
- GREEN=$(tput setaf 2)
- NORMAL=$(tput op)
-
tput hpa 0
if [ $1 -eq 0 ]; then
/bin/echo -ne "[${GREEN} ok ${NORMAL}"
@@ -77,14 +76,11 @@ log_status()
echo
}
-#############################################
-# output all args to stderr and exit with
-# return code 1
-#
-
+# exit with given error message
+# $1 - error message
die() {
- echo $* 1>&2
- exit 1
+ echo -e "${RED}$1${NORMAL}"
+ exit 1
}
#############################################