Shell Tips--color output

Source: Internet
Author: User

The shell, as a scripting language, is a skill that every Linux administrator must master, sometimes adding some background color to the output in the shell, making the script a little more aesthetically pleasing, and using echo to output a string, by default, the string echo displays is white.

650) this.width=650; "title=" QQ picture 20150402132920.png "Src=" http://s3.51cto.com/wyfs02/M00/5C/36/ Wkiol1uc1jhbe6ceaaanlujjvlw274.jpg "alt=" Wkiol1uc1jhbe6ceaaanlujjvlw274.jpg "/>

We can add some color

650) this.width=650; "title=" QQ picture 20150402133117.png "Src=" http://s3.51cto.com/wyfs02/M01/5C/36/ Wkiol1uc1qtx0jnoaaakigumyd4798.jpg "alt=" Wkiol1uc1qtx0jnoaaakigumyd4798.jpg "/>

So how does it come true? The original script code is given below

650) this.width=650; "title=" QQ picture 20150402133236.png "Src=" http://s3.51cto.com/wyfs02/M01/5C/36/ Wkiol1uc1vkbknfzaabciue0ihe828.jpg "alt=" Wkiol1uc1vkbknfzaabciue0ihe828.jpg "/>

Probably see so many numbers a little bit ignorant, give specific format just fine

"\033[front character color; background color xxxx\033[0m" no later.

The last [0m represents the restoration of the original color, if not added, it would be the effect

650) this.width=650; "title=" QQ picture 20150402133526.png "Src=" http://s3.51cto.com/wyfs02/M02/5C/3B/ Wkiom1uc1ltdmqjraabkewc2sac514.jpg "alt=" Wkiom1uc1ltdmqjraabkewc2sac514.jpg "/>

The command prompt and commands are red when you see them.

The specific color there are many people need to remember the color of the code, such as \033[32 on behalf of Green, we search down the test bar.

This article is from the "Sir Teng" blog, please be sure to keep this source http://naturelong1989.blog.51cto.com/627491/1627651

Shell Tips--color output

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.