shell echo颜色例子
2016-06-22 16:20
267 查看
#!/bin/bash ## test color for script RED_COLOR='\E[1;31m' GREEN_COLOR='\E[1;32m' YELLOR_COLOR='\E[1;33m' BLUE_COLOR='\E[1;34m' PINK='\E[1;35m' RES='\E[0m' if [ $# -eq 2 ] then echo "Usage:`basename $0` content {red|blue|yellow|pink|res|green}" exit 1 fi function echo_color(){ case $2 in red|RED) echo -e "${RED_COLOR}$1${RES}" ;; green|GREEN) echo -e "${GREEN_COLOR$1${RES}}" ;; yellow|YELLOW) echo -e "${YELLOW_COLOR}$1${RES}" ;; BLUE|blue) echo -e "${BLUE_COLOR}$1${RES}" ;; PINK|pink) echo -e "${PINK}$1${RES}" ;; *) echo -e "${PINK}$1${RES}" esac } echo_color abc red echo_color def pink
相关文章推荐
- shell基础用法
- Shell的命令的结果重定向
- shell--简单练习题
- shell脚本编程
- Bash 获取当前函数名
- adb shell 如何选择特定的设备?
- shell命令-grep
- shell eval命令使用
- Shell的sort
- linux shell脚本读取用户输入的参数
- Shell脚本return、echo、printf
- jmeter BeanShell实例-----两个变量之间的断言对比
- 使用ant直接执行shell命令
- c 嵌入 shell
- shell --- 相关简单程序规整
- 使用powershell远程传输文件
- xshell 缺少MSVCP110.dll
- shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别
- Shell使用技巧
- shell脚本:简单的分数记录系统