【问题标题】:-n option with ECHO command in Linux [closed]Linux中带有ECHO命令的-n选项[关闭]
【发布时间】:2013-12-28 06:30:56
【问题描述】:

-n 标志在 Linux 中与 echo 命令有什么用?

echo -n

【问题讨论】:

  • 如果您是 Linux 新手,请学习使用内置的helpman 命令。
  • 如果您正在查看 Windows 机器上的 sh 脚本,则您没有内置帮助。您必须使用在线资源。

标签: linux command


【解决方案1】:

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.

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

【讨论】:

  • 对一个简单问题的礼貌、有帮助的回答的道具!