How to output color text with Shell scripts in Linux

Source: Internet
Author: User


In Linux, how does one output the echo-e "\ 033 [44; 37; 5 m ME \ 033 [0 m COOL" command in a Shell script: the background color is blue, the foreground color is white, the font flashes, the output character ME, And then reset the screen to the default settings. After the output character me, the color returns to normal: www.2cto.com e is an option of echo, it is used to activate the parser for special characters. \ 033 indicates the sequence of unconventional characters. It means to set the attribute and end the sequence of unconventional characters. In this example, the valid characters are 44, 37, 5, and 0. Modify 44; 37; 5 to generate a combination of different colors. The values are irrelevant to the order of encoding. You can select the encoding as follows: encoding color/Action 0 reset properties to the default settings 1 set bold 2 set half brightness (simulate color display color) 4. Set the underline to simulate the color of the color display) 5 set flashing 7 set reverse image 22 set general density 24 turn off underline 25 turn off blinking 27 turn off reverse image 30 set black foreground 31 set red foreground 32 set green foreground 33 set brown foreground 34 set blue foreground 35 set purple foreground 36 set cyan foreground 37 set white foreground 38 set underline on default foreground color 39 disable underline on default foreground color 40 set black background 41 set red background 42 set green background 43 set brown background 44 set blue background 45 set purple background 46 set blue background 47 set white background 49 set default black background

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.