mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-09 21:53:47 -05:00
Better handling of true/false 1/0
This commit is contained in:
@@ -60,7 +60,7 @@ function _alert() { #my function
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Print to $logFile
|
# 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;
|
echo -e "$(date +"%m-%d-%Y %r") $(printf "[%9s]" ${1}) "${_message}"" >> $logFile;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -79,9 +79,9 @@ function success () { local _message="${@}"; echo "$(_alert success)"; }
|
|||||||
function input() { local _message="${@}"; echo "$(_alert input)"; }
|
function input() { local _message="${@}"; echo "$(_alert input)"; }
|
||||||
function header() { local _message="========== ${@} ========== "; echo "$(_alert header)"; }
|
function header() { local _message="========== ${@} ========== "; echo "$(_alert header)"; }
|
||||||
|
|
||||||
# Log messages when verbose is set to "1"
|
# Log messages when verbose is set to "true"
|
||||||
verbose() {
|
verbose() {
|
||||||
if [ "${verbose}" -eq "1" ]; then
|
if [ "${verbose}" = "true" ] || [ ${verbose} == "1" ]; then
|
||||||
debug "$@"
|
debug "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user