Echo command
Echo command: Write arguments to the standard output. (write parameters to dimension output)
Echo sends the input string to standard output. The output string is separated by a blank character with a newline number at the end
Echo [- ne] [string]
NAME
Echo-display a line of text
SYNOPSIS
Echo [SHORT-OPTION]... [STRING]...
Echo LONG-OPTION
Options:
-n: cancel the last automatic line wrapping
-e: if the following character appears in the string, it will be specially treated instead of outputting it as a normal character
\ a sound of warning
\ b Delete the previous character
[root@centos7 ~] # echo-e "he\ bllo"
Hllo
\ c No newline character is added at last
[root@centos7 ~] # echo-e "he\ cllo"
He [root@centos7 ~] # echo-e "hello\ c"
Hello [root@centos7 ~] # ^ C
\ f wrap but the cursor remains in its original position
[root@centos7 ~] # echo-e "he\ fllo"
He
Llo
\ nWrap and the cursor moves to the beginning of the line
[root@centos7 ~] # echo-e "he\ nllo"
He
Llo
\ r move the cursor to the beginning of the line, but do not wrap
[root@centos7 ~] # echo-e "hello\ rman"
Manlo
\ t insert Tab
[root@centos7 ~] # echo-e "hello\ tman"
Hello man
\ v is the same as\ f
[root@centos7 ~] # echo-e "he\ vllo"
He
Llo
\ insert\ character
[root@centos7 ~] # echo-e "he\\ llo"
He\ llo
\ nnn inserts ASCII characters represented by nnn (octal)
[root@centos7 ~] # echo-e "hello\ 052"
Hello*
Echo display color output:
Echo can change the color of the output text, and the desired-e option can be used to generate the display color of the text using the "ANSI unconventional character sequence".
Such as
Use echo to display a triangle with flashing, underlining, color (optional)
[root@centos7 ~] # echo-e "\ 033 [40 × 31 * 4 * 5m *\ n *\ n * *\ n *\ 033 [0m"
\ 033 [40 position 31x 4x 5m means to set the black background to the red foreground, turn on the underline and flash.
\ nindicates a line break and skip to the beginning of the line
\ 033 [0m means to reset the attribute and end the unconventional character sequence
Note:\ 033 guides the unconventional character sequence,\ 033 [indicates the beginning of the terminal escape character;\ 033 is the ASCII code of the exit key ESC, m indicates setting the attribute, and then ends the unconventional character sequence. In this example, 40 represents a black background, 31 represents a red foreground, 4 indicates underlining on, and 5 indicates flicker on. The numerical value has nothing to do with the order in which it is encoded. Specific values can be viewed in the ANSI standard color table.