Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to output colors with echo

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use echo to output colors, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Grammar introduction:

Echo-e "\ e [31m input\ e [0m" # output is red

Example:

# Color: 30m echo-e "\ 033 [30m black word\ 033 [0m" echo-e "\ 033 [31m red word\ 033 [0m" echo-e "\ 033 [32m green word\ 033 [0m" echo-e "\ 033 [33m yellow word\ 0m" echo-e "\ 033 [34m blue word\ 033 [0m" echo-e "\ 033 [35m" echo-e "\ 033] Purple words\ 033 [0m "echo-e"\ 033 [36m sky blue words\ 033 [0m "echo-e"\ 033 [37m white words\ 033 [0m "# words background color range: 40 echo 47 echo-e"\ 033 [40 37m White character on Black background\ 033 [0m "echo-e"\ 033 [41X 37m White character on Red background\ 033 [0m "echo-e"\ 033] [42X 37m White character on Green background\ 033 [0m "echo-e"\ 033 [43it37m White character on Yellow background\ 033 [0m "echo-e"\ 033 [44trans37m "echo-e"\ 033 [0m "echo-e"\ 033] [45x 37m White character on Purple background\ 033 [0m "echo-e"\ 033] 37m White words on Blue background\ 033 [0m "echo-e"\ 033 [47cross 30m Black on White background\ 033 [0m "

Last control:

\ 33 [0m turn off all attributes\ 33 [1m set high brightness\ 33 [4m underline\ 33 [5m flicker\ 33 [7m reverse display\ 33 [8m blanking\ 33 [30m -\ 33 [37m set foreground color\ 33 [40m -\ 33 [47m set background color\ 33] [nA cursor up n line\ 33 [nB cursor down n line\ 33 [nC Move the cursor to the right on line\ 33 [nD cursor to the left on line\ 33 [y XH set cursor position\ 33 [2J clear screen\ 33 [K clear the content from the cursor to the end of the line\ 33 [s save cursor location\ 33 [u restore cursor position\ 33 [? 25l hide cursor\ 33 [? 25h display cursor above options can be used in combination! After reading the above, have you mastered how to use echo to output colors? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report