From af6a526dfdec5dfa739ed50f149e036c01c9edb7 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 4 Oct 2017 19:18:56 +1100 Subject: [PATCH] test for 'printf' (cherry picked from commit d1e823af1513e70c8999c59577653dc39ec18895) --- bin/tests/system/conf.sh.in | 43 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 3f0b79bf2c..f9228d7434 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -153,21 +153,34 @@ else COLOR_NONE='' fi -echofail () { - printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*" -} - -echowarn () { - printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*" -} - -echopass () { - printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*" -} - -echoinfo () { - printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*" -} +if type printf > /dev/null 2>&1 +then + echofail () { + printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*" + } + echowarn () { + printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*" + } + echopass () { + printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*" + } + echoinfo () { + printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*" + } +else + echofail () { + echo "$*" + } + echowarn () { + echo "$*" + } + echopass () { + echo "$*" + } + echoinfo () { + echo "$*" + } +fi # # Export command paths