echo Display in shell script with color display, 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"
Example: Echo-e "\033[41;36m something here \033[0m"
Where 41 of the position represents the background, 36 of the position is the color of the word
Note:
1, the word background color and the text color is in 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 is the corresponding word and background color, you can try to find out the different color collocation
Echo-e "\033[31m Red word \033[0m"
Echo-e "\033[34mxxx word \033[0m"
Echo-e "\033[41;33m Red bottom yellow word \033[0m"
Echo-e "\033[41;37m Red bottom White \033[0m"
Word Color: 30-–37
Echo-e "\033[30m Black character \033[0m"
Echo-e "\033[31m Red word \033[0m"
Echo-e "\033[32m Green word \033[0m"
Echo-e "\033[33mxxx 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[37m White character \033[0m"
Word background color range: 40-–47
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 \033[0m"
Echo-e "\033[44;37m Blue bottom White \033[0m"
Echo-e "\033[45;37m Purple \033[0m"
Echo-e "\033[46;37m sky blue Bottom White \033[0m"
Echo-e "\033[47;30m black character \033[0m on white background"
Option control
\33[0m Close All properties \33[1m set high brightness \33[4m underline \33[5m blink \33[7m reverse \33[8m fade \33[30m-\33[37m set foreground color \33[40m-\33[47 M set background color \33[na cursor up n line \33[NB cursor down n line \33[NC cursor right shift n row \33[nd cursor left n line \33[y;xh set cursor position \33[2j Clear screen \33[k clears contents from cursor to end of line \33[s Save cursor position \33[u restore cursor position \33[?25l Hide cursor \33[?25h display cursor
echo Display content with color display in shell scripts