Linux echo command

Source: Internet
Author: User

Function Description: displays text.

Syntax: echo [-ne] [String] or echo [-- help] [-- version]

Note: echo sends the input string to the standard output. The output strings are separated by blank characters, and the line number is added at the end.

Parameter number:-n. Do not wrap the line at the end.

-E if the following characters appear in the string, it will be specially processed and will not be treated as a general text output:

\ A sends an alert;

\ B Delete the previous character;

\ C does not end with a line break;

\ F line feed, but the cursor remains at the original position;

\ N wrap and move the cursor to the beginning of the line;

\ R move the cursor to the beginning of the line without line breaks;

\ T Insert tab;

\ V is the same as \ f;

\ Insert \ characters;

\ Nnn inserts the ASCII characters represented by nnn (octal;

-- Help: Display help

-- Version: displays version information.

When echo needs to change the color, use the-e parameter.

Format:
Echo-e "\ 033 [background color; font color m string \ 033 [0 m"

For example:

Echo
-E "\ 033 [41; 36 m something here \ 033 [0 m"

Where 41 represents the background color,
The position 36 represents the color of the word.

Ascii
Code is the beginning and end of the color call.

\ 033 [
; M ...... \ 033 [0 m

Change the font to red and keep flashing

# Echo
-E "\ 033 [31 m \ 33 [05 m please confirm whether to stop the current squid process, enter
[Y/N] \ 033 [0 m"

Or

# Echo
-E "\ 033 [31 m \ 033 [05 m please confirm whether to stop the current squid process, enter
[Y/N] \ 033 [0 m"

Color Range: 40----49

40: Black

41: dark red

42: Green

43: Yellow

44: Blue

45: Purple

46: dark green

47: white

Color: 30-----------39

30: Black

31: red

32: Green

33: Yellow

34: Blue

35: Purple

36: dark green

37: white

========================================================== ======= ANSI Control Code Description

\ 33 [0 m
Disable all attributes

\ 33 [1 m
Set High Brightness

\ 33 [4 m
Underline

\ 33 [5 m
Flashing

\ 33 [7 m
Reverse display

\ 33 [8 m
Blanking

\ 33 [30 m
-- \ 33 [37 m set foreground color

\ 33 [40 m
-- \ 33 [47 m set the background color

\ 33 [Na
Move n rows above the cursor

\ 33 [Nb
Move the cursor down n rows

\ 33 [NC
Move the cursor n rows to the right

\ 33 [Nd
Move the cursor n rows left

\ 33 [Y; XH: Set the cursor position

\ 33 [2j
Clear Screen

\ 33 [K
Clear content from cursor to end of line

\ 33 [s
Save cursor position

\ 33 [u
Restore cursor position

\ 33 [? 25l
Hide cursor

\ 33 [? 25 h
Show cursor

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.