开始研究研究脚本,脚本是个好东西,很方便,很实用,节约时间,效率高;
下面是我写的一个简单脚本小程序,太基础,记录一下自己的学习过程!
#!/bin/bash #description: test function echo_color() { if [ $1 == "green" ]; then echo -e "\033[32;40m$2\033[0m" elif [ $1 == "red" ]; then echo -e "\033[31;40m$2\033[0m" fi } function echo_color2() { case $1 in green) echo -e "\033[32;40m$2\033[0m";; red) echo -e "\033[31;40m$2\033[0m";; *) echo "echo_color{green|red}] string" esac } echo_color red "wodemin" echo_color2 red "lvzilong" echo_color2 green "zhangsanfeng"
那么奇迹出现了,嘿嘿嘿...
有图有真相,嘻嘻嘻...
如果转载请注明转于:AirZilong的博客
原文链接:https://www.f2er.com/bash/391207.html