echo. The function of the echo command is to display a piece of text on the display, which generally acts as a The role of prompting.
The general format of this command is: echo [ -n ] string
The option n means that the output text will not be newline; the string can be quoted or not. When using the echo command to output a quoted string, the string is output as it is; when using the echo command to output an unquoted string, each word in the string is output as a string, and each string is separated by a space .
Function description: Display text.
Syntax: echo [-ne][string] or echo [--help][--version]
Additional description: echo will send the input string to standard output. The output strings are separated by whitespace characters and appended with a newline at the end.
Parameters: -n don't wrap the line at the end
-e If the following characters appear in the string, they will be treated specially instead of being
output as normal text:
\a emit a warning sound;
\b delete the previous character;
\c last Do not add a newline;
\f wraps the line but the cursor remains at the original position;
\n wraps the line and moves the cursor to the beginning of the line;
\r moves the cursor to the beginning of the line, but does not wrap;
\t inserts a tab;
\v and \f same;
\\ insert \ character;
\nnn insert ASCII character represented by nnn (octal);
--help display help
--version display version information
-----------------------------------------------------------------------------------------------
The echo command of Linux is very commonly used in shell programming, and it is also often used when printing variable values under the terminal.
For example: echo can be used as a display comment, which is used in some batch commands that need to be commented to the user. For example, the execution of the previous command will take a long time. Echo is often used to display a message to let the user know that this time is slow and wait a little. a while.
The echo command in Linux is used to display a block of characters on the standard output, for example:
echo "the echo command test!"
This will output the line "the echo command test!"!
echo "the echo command test!">a.shThis will output the line "the echo command test!" in the a.sh file! The general format of this command is: echo [ -n ] string where option n means no line break after the output text; the string can be quoted or not. When using the echo command to output a quoted string, the string is output as it is; when using the echo command to output an unquoted string, each word in the string is output as a string, and each string is separated by a space .