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

What are the echo commands of the Linux system

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

What are the echo commands of the Linux system? I believe many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Linux system echo command is a commonly used command, its function is to display a section of text on the display, which generally plays the role of a prompt.

1. The output after echo can be placed in double quotes, single quotation marks and reverse single quotation marks. The differences between double quotation marks, single quotation marks and reverse single quotation marks are as follows.

When a.echo adds single quotation marks, it will eliminate the special meaning of the contents (commands, variables, etc.) in the quotation marks, and the contents in the quotation marks will be displayed directly.

B. when echo is followed by double quotes, the ordinary content and commands are displayed directly, and the variable parses the result.

When c.echo follows single quotation marks, there must be a command in single quotation marks, and the result will be displayed on a line after the command is executed.

2. Common functional options and usage

A.-n does not automatically wrap at the end of the character

Special execution is performed if the following special symbols are found in the string after b.-e

\ a make a sound

\ B move the cursor forward one bit and overwrite the output after that. If there is no content after that, the existing content will not be overwritten.

\ C the output of subsequent content is not performed, and line wrapping is not automatically performed.

\ nWrap

\ r then the content moves to the beginning of the line input, overwriting the previous input.

\ t insert tab, i.e. four spaces

\ insert\ symbol

The point is:

\ 0nnn inserts the ASCII character represented by nnn (octal).

\ xHH inserts the ASCII character represented by HH (hexadecimal).

These two special symbols can add rich features to the output, such as background color and text color, flicker, underlining and bold.

This is to use octal and hexadecimal snorlax for the same content plus the same features, where:

Both "\ 033" and "\ x1B" represent escaped characters inserted into the ASCII character table

"\ 033 [" indicates the start of terminal escape

"43 × 35" and "0" represent the text characteristics represented by the character sequences in the ANSI table.

"m" indicates that the property setting is complete and ends the ANSI character sequence

The correspondence between more numbers and the text properties they represent is shown in the ANSI table:

Coded color / action

0 reset properties to default settings

1 set bold

2 set half brightness (simulate the color of the color monitor)

4 set the underline (simulate the color of the color monitor)

5 set flicker

7 set the reverse image

22 set general density

24 turn off the underline

25 turn off flashing

27 turn off reverse image

30 set the black foreground

31 set the red foreground

32 set the green foreground

33 set the foreground

34 set the blue foreground

35 set purple foreground

36 set cyan foreground

37 set white (gray) foreground

38 underline the default foreground color

39 turn off underlining on the default foreground color

40 set a black background

41 set the red background

42 set the green background

43 set the background

44 set the blue background

45 set purple background

46 set cyan background

47 set a white (gray) background

49 set the default black background

After reading the above, have you mastered the methods of echo commands in Linux system? 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

Development

Wechat

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

12
Report