diff --git a/scripts/function/display_error b/scripts/function/display_error index fe632ad..0881c24 100644 --- a/scripts/function/display_error +++ b/scripts/function/display_error @@ -1,8 +1,13 @@ display_error() { - tput sgr0 - tput setaf 1 - echo "ERROR: $1" >&2 - tput sgr0 + which tput &> /dev/null + if [[ "$?" == "0" ]]; then + tput sgr0 + tput setaf 1 + echo "ERROR: $1" >&2 + tput sgr0 + else + echo "ERROR: $1" >&2 + fi return 1 } diff --git a/scripts/function/display_fatal b/scripts/function/display_fatal index 68fa12d..3185d20 100644 --- a/scripts/function/display_fatal +++ b/scripts/function/display_fatal @@ -1,8 +1,13 @@ display_fatal() { - tput sgr0 - tput setaf 1 - echo "ERROR: $1" >&2 - tput sgr0 + which tput &> /dev/null + if [[ "$?" == "0" ]]; then + tput sgr0 + tput setaf 1 + echo "ERROR: $1" >&2 + tput sgr0 + else + echo "ERROR: $1" >&2 + fi exit 1 } diff --git a/scripts/function/display_message b/scripts/function/display_message index 4513e17..6b0521c 100644 --- a/scripts/function/display_message +++ b/scripts/function/display_message @@ -1,7 +1,12 @@ display_message() { - # GREEN! - tput sgr0 - tput setaf 2 - echo "$1" - tput sgr0 + which tput &> /dev/null + if [[ "$?" == "0" ]]; then + # GREEN! + tput sgr0 + tput setaf 2 + echo "$1" + tput sgr0 + else + echo "$1" + fi } diff --git a/scripts/function/display_warning b/scripts/function/display_warning index f0c475f..0cc6fdd 100644 --- a/scripts/function/display_warning +++ b/scripts/function/display_warning @@ -1,7 +1,12 @@ display_warning() { - # YELLOW! - tput sgr0 - tput setaf 3 - echo "$1" - tput sgr0 + which tput &> /dev/null + if [[ "$?" == "0" ]]; then + # YELLOW! + tput sgr0 + tput setaf 3 + echo "$1" + tput sgr0 + else + echo "$1" + fi }