Skip to content
Snippets Groups Projects
Commit 8386e304 authored by micah's avatar micah :speech_balloon:
Browse files

Converted some bashisms to POSIX -- no concept of arrays in posix, bleh

parent 85a7eb35
Branches
Tags
No related merge requests found
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
##################################################### #####################################################
## FUNCTIONS ## FUNCTIONS
function setupcolors() { setupcolors () {
BLUE="\033[34;01m" BLUE="\033[34;01m"
GREEN="\033[32;01m" GREEN="\033[32;01m"
YELLOW="\033[33;01m" YELLOW="\033[33;01m"
...@@ -27,20 +27,18 @@ function setupcolors() { ...@@ -27,20 +27,18 @@ function setupcolors() {
RED="\033[31;01m" RED="\033[31;01m"
OFF="\033[0m" OFF="\033[0m"
CYAN="\033[36;01m" CYAN="\033[36;01m"
COLORS=($BLUE $GREEN $YELLOW $RED $PURPLE)
} }
function colorize() { colorize () {
if [ "$usecolors" == "yes" ]; then if [ "$usecolors" == "yes" ]; then
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'` local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
[ "$typestr" == "Debug" ] && type=0 [ "$typestr" == "Debug" ] && COLOR=$BLUE
[ "$typestr" == "Info" ] && type=1 [ "$typestr" == "Info" ] && COLOR=$GREEN
[ "$typestr" == "Warning" ] && type=2 [ "$typestr" == "Warning" ] && COLOR=$YELLOW
[ "$typestr" == "Error" ] && type=3 [ "$typestr" == "Error" ] && COLOR=$RED
[ "$typestr" == "Fatal" ] && type=4 [ "$typestr" == "Fatal" ] && COLOR=$PURPLE
color=${COLORS[$type]}
endcolor=$OFF endcolor=$OFF
echo -e "$color$@$endcolor" echo -e "$COLOR$@$endcolor"
else else
echo -e "$@" echo -e "$@"
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment