How to make colors in echo output RED=’\033[0;31m’ NC=’\033[0m’ # No Color echo -e “${RED}Mathew${NC} Touchriver”
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
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