echo Output Color font: Format Example:
Echo–e "\033[31m is changed font color character \033[0m"
where \033[31m began,
* where (3 of the start control foreground color) 1 is red, this value is replaced with 2 is green,3 Brown,4 Blue,5 Purple,6 bluish green
* background Color control string starting with 4
* Single character set font (1 is bold, 4 is underline;5 is blinking;7 reverses foreground, background)
Example:1;
\033[0m End
The format is as follows (# # represents numbers, where 3#;4#;# can write only one or several items! Must have the end character, otherwise the terminal after the display of characters are like this! Start character ends with m)
Echo-e "\033[3#;4#; #m character \033[0m changed font color "
This can be used in scripts:
Red= ' \033[31m '
Ter= ' \033[0m '
Echo-e "${red}hello${ter}"
/etc/sysconfig/init
/etc/init.d/functions---- Red Hat Many scripts call the function function of this 2 file! Read these 2 files to learn more about Shell programming skills!
Move character display:echo–e "\033[40gabc" #40 represents the number of characters moved from left to right, and then displays the ABC
Startup in the service script, and so on, the successful execution of the [OK] display:
Echo-n "Starting testservice ..." echo-e "\033[60g [\033[32mok \033[0m]"
*) regardless of the number of preceding control characters, there is only one end character.
This article from the "Let me more Hungry" blog, please be sure to keep this source http://ufirst.blog.51cto.com/7628670/1432615