Home >Operation and Maintenance >Linux Operation and Maintenance >How to output linux without line breaks
In Linux, you can use the "-n" parameter of the echo command to output without newlines; the echo command is used to output strings. When the parameter is set to "-n", the end of the line after the output will be cancelled. Newline symbol, that is, no newline after the content is output, the syntax is "echo -n output content".
#The operating environment of this article: linux7.3 system, Dell G3 computer.
The function of the echo command is to display a piece of text on the monitor, which generally serves as a prompt. In addition, you can also write the content you want to write directly in the file.
The syntax is:
echo [选项] [输出内容]
Two commonly used options for the echo command: -n and -e
-n: indicates after output No line breaks.
# -e: Indicates that escaped characters are processed in the corresponding way.
(If you do not add -e, then the righteous character will be processed according to ordinary characters during the output, and it will not achieve the purpose you want to achieve.)
Examples are as follows:
Ordinary strings can be input directly after echo, but this will cause problems when certain characters such as \ are to be output (this way of writing Sometimes \ is treated as a line continuation character and filtered out. To output a \, you must type \\, which is similar to the requirements for C language printf output), so it is generally best to use ´string´ or "string" format, like this Even \ can be output, which is convenient and intuitive.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to output linux without line breaks. For more information, please follow other related articles on the PHP Chinese website!