echo Display in shell script with color display, echo display with color, need to use the parameter-e format 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: www.2cto.com 1, the word background color and the text color is in English" "2, the text color behind there is a M 3, before and after the string can have no space, if any, the output is also The same space below is the corresponding word and background color, you can try to find out the different color collocation
Example echo-e "\033[31m red word \033[0m" echo-e "\033[34m yellow word \033[0m" echo-e "\033[41;33m red bottom yellow word \033[0m" echo-e "\033[41;37 M Red Bottom white \033[0m "Word color: 30-–37 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[37m white word \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 "the \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 "\03 3[46;37m sky blue \033[0m "echo-e" \033[47;30m white background black \033[0m "last Face Control option description www.2cto.com \33[0m Close all properties \33[1m set high Brightness \33[4 M underline \33[5m blinking \33[7m \33[8m blanking
\33[30m-\33[37m set foreground color \33[40m-\33[47m set background \33[na cursor up n row \33[nb cursor down n line \33[NC cursor right shift n line \33[nd cursor left n line \33[y;xh set 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
Cases:
Turn the font into red and keep flashing
#echo-E "\033[31m \033[05m please confirm your operation, enter [y/n] \033[0m"
Word background color range: 40-49
40: Black
41: Crimson
42: Green
43: Yellow
44: Blue
45: Purple
46: Dark Green
47: White
Word Color: 30-39
30: Black
31: Red
32: Green
33: Yellow
34: Blue
35: Purple
36: Dark Green
37: White
ANSI Control code
\33[0m Close All Properties
\33[01m Setting High brightness
\33[04m Underline
\33[05m Flashing
\33[07M Reverse Display
\33[08m 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
Shell Display with color font