Linux 中带有 ECHO 命令的 -n 选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20499578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:35:50  来源:igfitidea点击:

-n option with ECHO command in Linux

linuxcommand

提问by Vaishali Modi

What is the use for the -nflag with the echocommand in Linux?

linux中-necho命令的flag有什么用?

echo -n

采纳答案by Vaishali Modi

man echo

man echo

 -n    Do not print the trailing newline character.  This may also be achieved by appending `\c' to the end of the string, as is done
       by iBCS2 compatible systems.  Note that this option as well as the effect of `\c' are implementation-defined in IEEE Std
       1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002.  Applications aiming for maximum portability are strongly encouraged to
       use printf(1) to suppress the newline character.

Many built-in commands to Linux have a manpage (e.g. man ls), which is a great way to look at the manual without having to search online.

Linux 的许多内置命令都有一个man页面(例如man ls),这是一种man无需在线搜索即可查看ual的好方法。