#!/bin/bash


#######第一种方法(推荐使用 颜色函数)########

#########color code#############
RED="31m"      ## 姨妈红
GREEN="32m"    ## 水鸭青
YELLOW="33m"   ## 鸭屎黄
BLUE="35m"     ## 基佬紫
BLUE="36m"     ## 天依蓝

###############color echo func#################
colorEcho(){
    echo -e "\033[${1}${@:2}\033[0m" 1>& 2
}

###########第二种方法###############
Red_font_prefix="\033[31m"
Green_font_prefix="\033[32m"
Yellow_font_prefix="\033[33m"
Blue_font_prefix="\033[34m"

Green_background_prefix="\033[42;37m"
Red_background_prefix="\033[41;37m"
Font_color_suffix="\033[0m"
main(){
    colorEcho ${RED} "这是红色的字体！"
    colorEcho ${GREEN} "这是绿色的字体！"
    colorEcho ${YELLOW} "这是黄色的字体！" 
    colorEcho ${BLUE} "这是蓝色的字体！" 
    echo "#######################下面是第二种方法！###############################"
    echo
    echo -e "${Red_font_prefix}这是红色的字体！${Font_color_suffix}"
    echo -e "${Green_font_prefix}这是绿色的字体！${Font_color_suffix}"
    echo -e "${Yellow_font_prefix}这是黄色的字体！${Font_color_suffix}"
    echo -e "${Blue_font_prefix}这是蓝色的字体！${Font_color_suffix}"
}

main