Echo is the most common command in shell scripts, such as the if statement, for statement, and case statement .... These are not a comprehensive understanding of echo commands. There are many other echo parameters below:
My daily life and summary of the materials.
The echo command can output parameters to the standard output device. Multiple parameters are separated by spaces by default, and line breaks are automatically added after the output is complete.
The echo command is usually used to display output text. The syntax format of this command is as follows:
-N does not output the final line break \ n
-E: Explanation of escape characters
-E does not interpret escape characters
The above three parameters are mainly used. Others are only known and are not used much.
-View version
Srting specifies the displayed string
The echo command can use-e and-E to set whether to interpret escape characters. By default, this command is not interpreted.
Escape characters:
It is usually a combination of characters starting.
What are the escape characters?
\ A bell warning
\ B Delete the previous character
\ C is equivalent to \ n, and \ n at the end of the output is not
\ F form feed
\ N line feed
\ R press enter, that is, move the cursor to the first flight
\ T insert horizontal tab
\ V insert vertical tab
\ Insert backslash
\ 'And \ "insert single quotation marks and insert double quotation marks
[Root @ redhat ~] # Echo "I am a student" // output the original content to the monitor
I am a student
[Root @ redhat ~] # Echo "hello \ n shell" // escape characters are not interpreted by default
Hello \ n shell
[Root @ redhat ~] # Echo-e "hello \ n shell" //-e explanation of escape characters
Hello
Shell
[Root @ redhat ~] # Echo-E "hello \ n shell" // escape characters are not interpreted
Hello \ n shell
What is an alarm? That is, the system will hear the "ding" sound during the output. If it cannot be heard directly in the system, it can be remotely connected.
[Root @ redhat ~] # Echo-e "hello \ a \ n shell"
Hello
Shell
[Root @ redhat ~] # Echo-e "hello \ B \ n shell" // Delete the previous character
Hell
Shell
[Root @ redhat ~] # Echo-e "hello shell \ c" \ n "hello" // The \ c parameter means to stop it. If the previous
Hello shell
If the other one is not used .....