Advanced echo usage-color output and cursor positioning

Source: Internet
Author: User
When echo outputs the color, use the echo-e format: echo-e \ 033 [background color; Font color m, for example, echo-e \ 033 [32; in the above command, \ 033 [32; 40 m indicates defining the color of the subsequent text, \ 033 indicates starting an escape sequence, [defining the start color definition ,...
When echo outputs the color, use the echo-e format "\ 033 [background color; Font color m", for example, echo-e "\ 033 [32; in the above command, "\ 033 [32; 40m" represents the color of the subsequent text, "\ 033" represents the start of an escape sequence, and "[" defines the start color definition, "0" defines the default font color, which will be defined later. "32" defines the foreground color of the text. Here 32 represents Green; "40" defines the background color of the text, and 40 represents black. Www.2cto.com we have a total of 8 font colors available, they are 30 (black), 31 (red), 32 (green), 33 (yellow), 34 (blue), 35 (purple), 36 (blue), and 37 (white ). There are also eight colors available for the base color. you only need to change 3 of the font color to 4, such as 40, 41, 42, 43, 44, 45, 46, and 47. In addition, we can also use echo to position the cursor, for example, echo-e "\ 033 [10; 5 h \ 033 [31; 46 mthis is a test", indicating, move the cursor to the 10th columns of the 5th rows and output the "this is a test" text. the foreground color is red, and the background color is more blue echo output control. The specific excerpt is as follows: \ 033 [0 m close all properties \ 033 [1 m set high brightness \ 033 [4 m underline \ 033 [5 m flashing \ 033 [7 m reverse display \ 033 [8 m hide \ 033 [30 m-\ 033 [37 m set foreground color \ 033 [40 m-\ 033 [47 m set background color \ 033 [nA cursor move n rows up www.2cto.com \ 033 [nB move the cursor down n rows \ 033 [move the nC cursor right n rows \ 033 [move the nD cursor left n rows \ 033 [y; xH set the cursor position \ 033 [2J clear screen \ 033 [K clear content from the cursor to the end of the line \ 033 [s save the cursor position \ 033 [u restore the cursor position \ 03 3 [? 25l hide the cursor \ 033 [? 25 h show cursor author But_Bueatiful
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.