Reverted bashism removals from r228, after discussing this.

This commit is contained in:
intrigeri 2005-11-29 10:32:02 +00:00
parent 31ac783dab
commit 4f344987a9

View File

@ -19,7 +19,7 @@
##################################################### #####################################################
## FUNCTIONS ## FUNCTIONS
setupcolors () { function 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,18 +27,20 @@ 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)
} }
colorize () { function colorize () {
if [ "$usecolors" == "yes" ]; then if [ "$usecolors" == "yes" ]; then
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'` local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
[ "$typestr" == "Debug" ] && COLOR=$BLUE [ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && COLOR=$GREEN [ "$typestr" == "Info" ] && type=1
[ "$typestr" == "Warning" ] && COLOR=$YELLOW [ "$typestr" == "Warning" ] && type=2
[ "$typestr" == "Error" ] && COLOR=$RED [ "$typestr" == "Error" ] && type=3
[ "$typestr" == "Fatal" ] && COLOR=$PURPLE [ "$typestr" == "Fatal" ] && type=4
color=${COLORS[$type]}
endcolor=$OFF endcolor=$OFF
echo -e "$COLOR$@$endcolor" echo -e "$color$@$endcolor"
else else
echo -e "$@" echo -e "$@"
fi fi