echo输入字符串有颜色

declare FBS_ESC=`echo -en "\033"`;
declare FBS_EXTD="${FBS_ESC}[1m";
declare FBS_WARN="${FBS_ESC}[1;31m";    # warning,red
declare FBS_DONE="${FBS_ESC}[1;32m";    # done,green
declare FBS_ATTN="${FBS_ESC}[1;33m";    # attention,yellow
declare FBS_HELP="${FBS_ESC}[1;36m";    # help,blue
declare FBS_PROMPT="${FBS_ESC}[1;37m";  # prompt,white
declare FBS_HEAD="${FBS_ESC}[7;37m";    # head
declare FBS_CLOSED="${FBS_ESC}[0m";     # end

 

例句:

echo -e "${FBS_PROMPT} stop service successfully.${FBS_CLOSED}"   | tee -a  $LOG_FILE;

stop service successfully.字符串的颜色为white;

echo -e "${FBS_WARN} Wrong operation.${FBS_CLOSED}"   | tee -a  $LOG_FILE;

Wrong operation.字符串的颜色为red;

 

你可能感兴趣的:(Linux)