#!/bin/bash
## 声明变量
declare -A color
# 定义颜色
# bc_color : background color
color[red]="e[1;31m"
color[green]="e[1;32m"
color[yellow]="e[1;33m"
color[blue]="e[1;34m"
color[purple]="e[1;35m"
color[bc_red]="e[41m"
color[bc_green]="e[42m"
color[bc_yellow]="e[43m"
color[bc_blue]="e[44m"
color[bc_purple]="e[45m"
color[exit]="e[0m"
color_red(){
echo -e "${color[red]}$@${color[exit]}"
}
color_yellow(){
echo -e "${color[yellow]}$@${color[exit]}"
}
color_green(){
echo -e "${color[green]}$@${color[exit]}"
}
color_blue(){
echo -e "${color[blue]}$@${color[exit]}"
}
color_purple(){
echo -e "${color[purple]}$@${color[exit]}"
}
color_red "hello!"
color_yellow "hello!"
color_green "hello!"
color_blue "hello!"
color_purple "hello!"