diff --git a/common.sh b/common.sh index 90d030f785..92c9f31e99 100644 --- a/common.sh +++ b/common.sh @@ -218,11 +218,20 @@ FACTORY_INSTALL_MASK=" /usr/share/zoneinfo " -V_REVERSE="$(tput rev)" -V_VIDOFF="$(tput sgr0)" -V_BOLD_RED="$(tput bold; tput setaf 1)" -V_BOLD_GREEN="$(tput bold; tput setaf 2)" -V_BOLD_YELLOW="$(tput bold; tput setaf 3)" +# Determine and set up variables needed for fancy color output (if supported). +V_REVERSE= +V_VIDOFF= +V_BOLD_RED= +V_BOLD_GREEN= +V_BOLD_YELLOW= + +if tput colors >/dev/null 2>&1; then + V_REVERSE="$(tput rev)" + V_VIDOFF="$(tput sgr0)" + V_BOLD_RED="$(tput bold; tput setaf 1)" + V_BOLD_GREEN="$(tput bold; tput setaf 2)" + V_BOLD_YELLOW="$(tput bold; tput setaf 3)" +fi # ----------------------------------------------------------------------------- # Functions