Echo command
Echo command between single and double quotation marks between strings and variables
"weak reference, command unrecognized, variable recognition.
Strong quotes, silly symbols, and any command is a string in his eyes. The command is not recognized and the variable is not recognized.
~ Command references, the cleverest, execute commands in the display. Command recognition, variable identification.
When one command invokes another command, $() = ~
For example: tough ~ whoami~= creates a root file
The function of the echo command is to display a piece of text on the monitor, which generally acts as a prompt.
The general format of the command is: echo [- n] string
The option n means that the output text is not wrapped; the string can be in quotation marks or not. When using the echo command to output the quoted string, the string will be output as is; when using the echo command to output the string without quotation marks, each word in the string will be output as a string, and each string will be separated by a space.
Function description: display text.
Syntax: echo [- ne] [string] or echo [--help] [--version]
Additional note: echo sends the input string to standard output. The output strings are separated by blank characters and are followed by a newline number.
Parameter: echo-n output without line wrapping
For example: echo-n "123"; echo "456"
Final output
123456
Instead of
one hundred and twenty three
four hundred and fifty six
Echo-e handles special characters (escape characters)
Text output:
\ a sound of warning
\ b delete the previous character; Backspace key
\ C finally, no newline symbol is added, the recycled newline is compressed, no newline is added, and the opposite is true.
\ f Wrap line, but the cursor remains in its original position
\ nWrap and the cursor moves to the beginning of the line
\ r move the cursor to the beginning of the line, but do not wrap it; move the cursor to the front, and then replace the characters with the same number of digits
\ t insert tab
\ v is the same as\ f
\ insert\ character
\ 0nnn inserts ASCII characters represented by nnn (octal)
Echo-e'\ 0101'= A
Echo-e "\ 033 [43 × 31mred" = 43 × × × background .31 red font (41-47 background, 31-37 font)
Echo-e "\ 033 [43 × 31mred color\ 033 [0m" can end the front background and wrap to show the red background color
Each file will define a different color (.gz: .exe, etc.), enter cat / etc/DIR_COLORS, you can see the color of the file name suffix, # .exe means no color, delete # will work, there will be color. And the file suffix color can be modified by nano.
Word background color range: 40 Muhami Muhami 49
40: White characters on black background
41: White characters with crimson background
42: White characters with green background
43: × × white characters at the bottom
44: White words on blue background
45: White characters on purple background
46: White characters with dark green background
47: black words on a white background
Word color: 30Mui Mui Mui 39
30: black
31: red
32: green
33: yellow
34: blue
35: purple
36: dark green
37: White
Description of ANSI control code
\ 33 [0m turn off all properties
\ 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 lines
\ 33 [nB cursor down n lines
\ 33 [move the nC cursor to the right n lines
\ 33 [nD cursor move left n lines
\ 33 [ytrexh sets the cursor position
\ 33 [2J clear screen
\ 33 [K clear the contents from the cursor to the end of the line
\ 33 [s Save cursor location
\ 33 [u restore cursor position
\ 33 [? 25l hide the cursor
\ 33 [? 25h display cursor
\ xHH inserts ASCII characters represented by HH (hexadecimal)
If the code is garbled, reset resets the screen
-help display help
-version displays version information