X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=src%2Fbackupninja.in;h=9330902e0bfcd97721deb29011e8ffa73972315b;hb=0d606253af6ecb8ede07b0991a1f295fb70e7e65;hp=7855a6d894791b3dc139a80a9892790d9dd38bfb;hpb=5b392f68baa6462fbb891a81ae05dcbbad91f91b;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/src/backupninja.in b/src/backupninja.in index 7855a6d..9330902 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -1,4 +1,6 @@ #!@BASH@ +# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# # |\_ # B A C K U P N I N J A /()/ # `\| @@ -19,7 +21,7 @@ ##################################################### ## FUNCTIONS -setupcolors () { +function setupcolors () { BLUE="\033[34;01m" GREEN="\033[32;01m" YELLOW="\033[33;01m" @@ -27,18 +29,20 @@ setupcolors () { RED="\033[31;01m" OFF="\033[0m" CYAN="\033[36;01m" + COLORS=($BLUE $GREEN $YELLOW $RED $PURPLE) } -colorize () { +function colorize () { if [ "$usecolors" == "yes" ]; then local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'` - [ "$typestr" == "Debug" ] && COLOR=$BLUE - [ "$typestr" == "Info" ] && COLOR=$GREEN - [ "$typestr" == "Warning" ] && COLOR=$YELLOW - [ "$typestr" == "Error" ] && COLOR=$RED - [ "$typestr" == "Fatal" ] && COLOR=$PURPLE + [ "$typestr" == "Debug" ] && type=0 + [ "$typestr" == "Info" ] && type=1 + [ "$typestr" == "Warning" ] && type=2 + [ "$typestr" == "Error" ] && type=3 + [ "$typestr" == "Fatal" ] && type=4 + color=${COLORS[$type]} endcolor=$OFF - echo -e "$COLOR$@$endcolor" + echo -e "$color$@$endcolor" else echo -e "$@" fi @@ -146,7 +150,7 @@ function tolower() { # simple to integer function function toint() { - echo "$1" | tr [:alpha:] -d + echo "$1" | tr -d [:alpha:] } #