aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2005-11-19 18:00:25 +0000
committerMicah Anderson <micah@riseup.net>2005-11-19 18:00:25 +0000
commit8386e304ff30df27e73d59fcae2a3ee3f03a9b70 (patch)
treef6ccce27b335425a71c0d4ca53b60d170ff48510
parent85a7eb350aa10565a9c1c72fd3a3a98d8d2a7504 (diff)
downloadbackupninja-8386e304ff30df27e73d59fcae2a3ee3f03a9b70.tar.gz
backupninja-8386e304ff30df27e73d59fcae2a3ee3f03a9b70.tar.bz2
Converted some bashisms to POSIX -- no concept of arrays in posix, bleh
-rwxr-xr-xsrc/backupninja.in18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/backupninja.in b/src/backupninja.in
index 387743f..31b8d1b 100755
--- a/src/backupninja.in
+++ b/src/backupninja.in
@@ -19,7 +19,7 @@
#####################################################
## FUNCTIONS
-function setupcolors() {
+setupcolors () {
BLUE="\033[34;01m"
GREEN="\033[32;01m"
YELLOW="\033[33;01m"
@@ -27,20 +27,18 @@ function setupcolors() {
RED="\033[31;01m"
OFF="\033[0m"
CYAN="\033[36;01m"
- COLORS=($BLUE $GREEN $YELLOW $RED $PURPLE)
}
-function colorize() {
+colorize () {
if [ "$usecolors" == "yes" ]; then
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
- [ "$typestr" == "Debug" ] && type=0
- [ "$typestr" == "Info" ] && type=1
- [ "$typestr" == "Warning" ] && type=2
- [ "$typestr" == "Error" ] && type=3
- [ "$typestr" == "Fatal" ] && type=4
- color=${COLORS[$type]}
+ [ "$typestr" == "Debug" ] && COLOR=$BLUE
+ [ "$typestr" == "Info" ] && COLOR=$GREEN
+ [ "$typestr" == "Warning" ] && COLOR=$YELLOW
+ [ "$typestr" == "Error" ] && COLOR=$RED
+ [ "$typestr" == "Fatal" ] && COLOR=$PURPLE
endcolor=$OFF
- echo -e "$color$@$endcolor"
+ echo -e "$COLOR$@$endcolor"
else
echo -e "$@"
fi