From 2db80bb12ecd63089f34d0a1e34313deecd8ae90 Mon Sep 17 00:00:00 2001 From: Peter Mosmans Date: Thu, 22 Oct 2015 17:35:28 +1000 Subject: [PATCH] Added check for availability of tput (Fixes #222) --- testssl.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 67bc145..04265ce 100755 --- a/testssl.sh +++ b/testssl.sh @@ -93,7 +93,7 @@ date --help >/dev/null 2>&1 && \ echo A | sed -E 's/A//' >/dev/null 2>&1 && \ readonly HAS_SED_E=true || \ readonly HAS_SED_E=false -TERM_DWITH=${COLUMNS:-$(tput cols)} # for future custom line wrapping +TERM_DWITH=${COLUMNS:-$(tput cols 2>/dev/null)} # for future custom line wrapping TERM_CURRPOS=0 # ^^^ we also need to find out the length or current pos in the line @@ -340,7 +340,10 @@ set_color_functions() { underline="" italic="" + # Hey wait, do we actually have tput / ncurses ? + tput -V &> /dev/null || return 0 tput sgr0 &>/dev/null || linux_tput=false + if [[ "$COLOR" -eq 2 ]]; then if $linux_tput; then red=$(tput setaf 1)