#!/bin/bash
Black_color= ' \e[1;30m '
Red_color= ' \e[1;31m '
Green_color= ' \e[1;32m '
Yellow_color= ' \e[1;33m '
Blue_color= ' \e[1;34m '
Purple_color= ' \e[1;35m '
Cyan_color= ' \e[1;36m '
White_color= ' \e[1;37m '
res= ' \e[0m '
Word=$1
Colors=$2
Case $ in
black| Black| Black)
Echo-e "$black _color $word $RES"
Exit 0
;;
red| red| Red)
Echo-e "$red _color $word $RES"
Exit 0
;;
green| Green| Green)
Echo-e "$green _color $word $RES"
Exit 0
;;
yellow| yellow|***)
Echo-e "$yellow _color $word $RES"
Exit 0
;;
blue| blue| Blue)
Echo-e "$blue _color $word $RES"
Exit 0
;;
purple| purple| purple)
Echo-e "$purple _color $word $RES"
Exit 0
;;
cyan| cyan| cyan)
Echo-e "$cyan _color $word $RES"
Exit 0
;;
white| white| White)
Echo-e "$white _color $word $RES"
Exit 0
;;
*)
echo "Usage:bash $ word color."
;;
Esac
This article is from the "ZPP" blog, make sure to keep this source http://1439337369.blog.51cto.com/10270624/1715600
Print a color string by passing a parameter