Home > Article > Operation and Maintenance > What does echo-n mean in centos?
In centos, "echo-n" means no newline after printing information. The echo command is used to print information. When the parameter is set to "-n", no newline will be displayed after printing information. Syntax is the message printed by echo -n.
The operating environment of this article: centos 6.4 system, Dell G3 computer.
Function description: The echo command is used to print information and is the most commonly used command. Commonly used in the command line to print the value of an environment variable to determine whether the specified environment variable is set in the current environment. In shell scripts, it is often used to print information and help debug programs.
Parameters:
-n No line breaks after printing information.
-e Escape the string.
Available escape characters:
a issues a warning sound;
\b deletes the previous character;
\c does not add a newline character at the end ;
\f Line break but the cursor still stays at the original position;
\n Line break and the cursor moves to the beginning of the line;
\r Cursor moves to the beginning of the line, but No line break;
\t inserts tab;
\v is the same as \f;
\\ inserts \ character;
\nnn inserts nnn ( ASCII characters represented by octal);
Usage examples:
(1) Display the current PATH
[root@LiWenTong test4]# echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/ato
(2) No line breaks after printing
[root@LiWenTong test4]# echo -n "pls input yourname:"; read name;echo "ths $name"---》read命令表示从键盘获取变量值。 pls input your name:atong ths atong [root@linux-lwt tmp]# echo "pls inpu " ; read name; echo "ths $name" pls inpu atong ths atong
(3) Escape characters
[root@LiWenTong test4]# echo -e "hello\nword" hello word [root@LiWenTong test4]# echo "hello\nword" hello\nword
Recommended tutorial: "centos tutorial"
The above is the detailed content of What does echo-n mean in centos?. For more information, please follow other related articles on the PHP Chinese website!