& Lt; echo command in Linux & gt;

Source: Internet
Author: User

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 .....

 

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.