From 0c88dc8933afd8d2f4e2011865aa4853acf2df9d Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Sun, 21 Jun 2015 11:53:50 -0400 Subject: [PATCH] Better handling of true/false 1/0 --- lib/utils.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index 0ba08d8..4e74293 100755 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -60,7 +60,7 @@ function _alert() { #my function fi # Print to $logFile - if [ "${printLog}" == "1" ]; then + if [ ${printLog} = "true" ] || [ "${printLog}" == "1" ]; then echo -e "$(date +"%m-%d-%Y %r") $(printf "[%9s]" ${1}) "${_message}"" >> $logFile; fi @@ -79,9 +79,9 @@ function success () { local _message="${@}"; echo "$(_alert success)"; } function input() { local _message="${@}"; echo "$(_alert input)"; } function header() { local _message="========== ${@} ========== "; echo "$(_alert header)"; } -# Log messages when verbose is set to "1" +# Log messages when verbose is set to "true" verbose() { - if [ "${verbose}" -eq "1" ]; then + if [ "${verbose}" = "true" ] || [ ${verbose} == "1" ]; then debug "$@" fi }