What does echo-n mean in centos?

WBOY
Release: 2022-02-08 15:02:01
Original
5484 people have browsed it

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.

What does echo-n mean in centos?

The operating environment of this article: centos 6.4 system, Dell G3 computer.

What does echo-n mean in centos

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
Copy after login

(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
Copy after login

(3) Escape characters

[root@LiWenTong test4]# echo -e "hello\nword"
hello
word
[root@LiWenTong test4]# echo   "hello\nword"
hello\nword
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!