One Reply to “How to make colors in echo output”

  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 Reply

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