How to make colors in echo output

RED=’\033[0;31m’
NC=’\033[0m’ # No Color

echo -e “${RED}Mathew${NC} Touchriver”

1 comment

  1. A still better approach below.

    NC=”\033[0m”
    display() {
    #quieten the shell outputs
    set +x
    #text colors
    case $2 in
    RED)
    COLOR=”\033[1;31m”
    ;;
    BLUE)
    COLOR=”\033[1;34m”
    ;;
    GREEN)
    COLOR=”\033[1;32m”
    ;;
    *)
    COLOR=”\033[1;33m”
    esac
    echo -e “$COLOR $1 $NC”
    }

    display “VERSION\t: $VERSION_VAR ” BLUE

Leave a comment

Your email address will not be published. Required fields are marked *