1、输出字体颜色库
#!/bin/bash export black='E[0mc' export boldred='E[1;31mc' export boldgreen='E[1;32mc' export boldyellow='E[1;33mc' export boldblue='E[1;34mc' export boldmagenta='E[1;35mc' export boldcyan='E[1;36mc' c_notify=$boldgreen #通过变量来修改颜色 c_error=$boldred cecho() { message=$1 color=${2:-$black} echo -e "$color" echo -e "$message" tput sgr0 # Reset to normal. echo -e "$black" return } cecho "1. #################" $boldred cecho "2. #################" $boldgreen cecho "3. #################" $boldyellow cecho "4. #################" $boldblue cecho "5. #################" $boldmagenta cecho "6. #################" $boldcyan cecho "启动成功" $c_notify cecho "启动失败" $c_error
输出效果: