The results echo shell scripts typically used to display messages or other output commands.
Outputting content colored display, requires the use of parameters -e
, the following format:
echo -e "\003[背景颜色;文字颜色;显示方式m字符串\003[0m"
Example:
echo -e "\033[40;31;5mSomething string\033[0m"
The code string is output Something string
in which the background color is black, the text color is red, flashing text;
Note:
- Background color, text color, display, you can mix and match, if missing an item will use the default option;
-
-e
Command isecho
an option, which is used to activate special characters parser can escape the backslash character; -
\033
Guide unconventional character sequence; -
m
Means set the properties and ends unconventional character sequence, there is a string that appears beforem
;
Display details:
Display method | meaning |
---|---|
0 | Close all properties |
1 | BBCode |
4 | Underline |
5 | flicker |
7 | Anti-significant |
8 | Blanking |
Color details:
Text color | background color | colour |
---|---|---|
30 | 40 | black |
31 | 41 | red |
32 | 42 | green |
33 | 43 | yellow |
34 | 44 | blue |
35 | 45 | Fuchsia |
36 | 46 | cyan |
37 | 47 | white |