From 472400d7e1cc520bbd362ff6c68e216560108911 Mon Sep 17 00:00:00 2001 From: Noah Swerhun Date: Sun, 10 Jul 2022 20:09:30 -0500 Subject: [PATCH] colors will not print on unsupported terminals --- cbuild.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cbuild.sh b/cbuild.sh index 3e229bc..ffcdd28 100755 --- a/cbuild.sh +++ b/cbuild.sh @@ -33,13 +33,15 @@ if [ -n "${PKG_CONFIG_LIBS}" ]; then LDLIBS="${CFLAGS} $(pkg-config --libs "${PKG_CONFIG_LIBS}")" fi -clear_formatting="\033[0m" -bold="\033[1m" -info_color="\033[34m" # default: "\033[34m" - blue -err_color="\033[31m" # default: "\033[31m" - red -build_progress_color="\033[35m" # default: "\033[35m" - magenta -build_info_color="\033[32m" # default: "\033[32m" - green -link_info_color="\033[36m" # default: "\033[36m" - cyan +if [ "$(tput colors)" != "-1" ]; then + clear_formatting="\033[0m" + bold="\033[1m" + info_color="\033[34m" # default: "\033[34m" - blue + err_color="\033[31m" # default: "\033[31m" - red + build_progress_color="\033[35m" # default: "\033[35m" - magenta + build_info_color="\033[32m" # default: "\033[32m" - green + link_info_color="\033[36m" # default: "\033[36m" - cyan +fi usage() { less <