echo display with color, need to use parameter-E
The format is as follows:
Echo-e "\033[word background color; text color m string \033[0m"
For example:
Echo-e "\033[41;37m Tonyzhang \033[0m"
Where 41 of the position represents the background, 37 of the position is the color of the word
Note:
1, the word background color and the text color is the English "" "
2. There is a m behind the text color
3, before and after the string can have no space, if any, the output is also a space
Here are a few examples:
echo-e "\033[30m black word \033[0m"
echo-e "\033[31m red word \033[0m"
echo-e "\033[32m green word \033[0m"
echo-e "\033[33m yellow word \033[0m"
echo-e "\033[34m Blue word \033[0m"
echo-e "\033[35m purple word \033[0m"
echo-e "\033[36m sky blue Word \033[0m"
echo-e "\033[40;37m Black Bottom white \033[0m"
echo-e "\033[41;37m Red bottom white \033[0m"
echo-e "\033[42;37m Green bottom white \033[0m"
echo-e "\033[43;37m Yellow bottom white \033[0m"
echo-e "\033[44;37m Blue bottom White \033[0m"
echo-e "\033[45;37m purple white \033[0m"
echo-e "\033[46;37m Blue bottom White \033[0m"
echo-e "\033[47;30m" Black word \033[0m "
Control Option Description:
\33[0m Close All Properties
\33[1m Setting High brightness
\33[4m Underline
\33[5m Flashing
\33[7M Reverse Display
\33[8m blanking
\33[30m--\33[37m setting foreground color
\33[40m--\33[47m set background color
\33[na the cursor to move n rows
\33[NB cursor down n rows
\33[NC cursor Right shifts n rows
\33[nd cursor left n rows
\33[y;xh Setting the cursor position
\33[2j Clear Screen
\33[k clears the contents from the cursor to the end of the line
\33[s Save cursor position
\33[u Restore cursor position
\33[?25l Hide Cursor
\33[?25h Display Cursor
This article is from the "Dream to Reality" blog, please be sure to keep this source http://lookingdream.blog.51cto.com/5177800/1826726
Let the echo command display a colored word in Linux