An explanation of the echo command under Linux

Source: Internet
Author: User
Tags echo command echo display

The echo command for Linux, which is very common in shell programming, is often used when printing variable value under a terminal, so it is necessary to understand the use of Echo

The function of the echo command is to display a piece of text on the display, which generally acts as a hint.
The general format of the command is: Echo [-n] String
where option n means that the output text is not wrapped, the string can be quoted, or it can be unquoted. When you output a quoted string with the Echo command, the string is output as it is, and when you output an unquoted string with the echo command, each word in the string is output as a string, separated by a space between the strings.

Feature Description: Displays text.
Syntax: Echo [-ne][string] or echo [--help][--version]
Additional note: Echo will send the input string to standard output. The output strings are separated by white space characters, and a newline number is added at the end.
Parameter:-n do not wrap in the last line
-E If the following characters appear in the string, they are handled in particular, not as a general
Text output:
\a issued a warning sound;
\b Delete the previous character;
\c finally not add the line break symbol;
\f the line but the cursor remains in its original position;
\ n Wraps and the cursor moves to the beginning of the line;
\ r The cursor moves to the beginning of the line, but does not wrap;
\ t Insert tab;
\v is the same as \f;
\ \ insert \ character;
\NNN inserts the ASCII character represented by the NNN (octal);
Help Display Help
–version displaying version information

-----------------------------------------------------------------------------------------------

The echo command for Linux is extremely common in shell programming and is often used when printing variable value under a terminal.

For example: Echo can be used as a display note for some batch commands that need to be commented to the user, such as the previous command execution will take a long time, often with echo display a message to let the user know this time is slow, a little wait.

The echo command in Linux is used to display a section of characters on the standard output, such as:
echo "The echo command test!"

This will output "the echo command test!." This line of text!

echo "The echo command test!" >a.sh
This will output "the echo command test!" in the a.sh file. This line of text! The general format of the command is: Echo [-n] string where option n means that the output text is not wrapped, the string can be quoted, or it can be unquoted. When you output a quoted string with the Echo command, the string is output as it is, and when you output an unquoted string with the echo command, each word in the string is output as a string, separated by a space between the strings.

An explanation of the echo command under Linux

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.