From 8d46a49a016fba76b90e15420e9361a5226bed87 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 21:24:07 +0100 Subject: [PATCH] Fix : binary operator expected and don't use a not not operator --- functions/fn_messages | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/functions/fn_messages b/functions/fn_messages index a4c618c2e..6d35314bd 100644 --- a/functions/fn_messages +++ b/functions/fn_messages @@ -8,7 +8,7 @@ # Date and servicename for log files. fn_scriptlog(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}" else echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}" @@ -17,7 +17,7 @@ fn_scriptlog(){ # [ FAIL ] fn_printfail(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@" @@ -25,7 +25,7 @@ fn_printfail(){ } fn_printfailnl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[0;31m FAIL \e[0m] $@" @@ -34,7 +34,7 @@ fn_printfailnl(){ # [ OK ] fn_printok(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[0;32m OK \e[0m] $@" @@ -42,7 +42,7 @@ fn_printok(){ } fn_printoknl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[0;32m OK \e[0m] $@" @@ -51,7 +51,7 @@ fn_printoknl(){ # [ INFO ] fn_printinfo(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@" @@ -59,7 +59,7 @@ fn_printinfo(){ } fn_printinfonl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[0;36m INFO \e[0m] $@" @@ -68,7 +68,7 @@ fn_printinfonl(){ # [ WARN ] fn_printwarn(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@" @@ -76,7 +76,7 @@ fn_printwarn(){ } fn_printwarnnl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[1;33m WARN \e[0m] $@" @@ -85,7 +85,7 @@ fn_printwarnnl(){ # [ .... ] fn_printdots(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[ .... ] $@" @@ -126,4 +126,4 @@ fn_printerror(){ fn_printerrornl(){ echo -e "\e[0;31mError!\e[0m $@" -} \ No newline at end of file +}