钻牛角尖的一个问题: 怎么查看 echo --help

sh/bash/dash/ksh/zsh等Shell脚本
回复
tdounnyy
帖子: 3
注册时间: 2010-05-21 21:52

钻牛角尖的一个问题: 怎么查看 echo --help

#1

帖子 tdounnyy » 2011-10-25 18:59

同理 echo --version

:em09
头像
wjchen
帖子: 583
注册时间: 2011-05-02 19:08
系统: ubuntu 12.04

Re: 钻牛角尖的一个问题: 怎么查看 echo --help

#2

帖子 wjchen » 2011-10-25 19:37

以下摘自man echo:
NOTE: your shell may have its own version of echo, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.
以下摘自man bash:

echo [-neE] [arg ...]
Output the args, separated by spaces, followed by a newline.
The return status is always 0. If -n is specified, the trailing
newline is suppressed. If the -e option is given, interpreta‐
tion of the following backslash-escaped characters is enabled.
The -E option disables the interpretation of these escape char‐
acters, even on systems where they are interpreted by default.
The xpg_echo shell option may be used to dynamically determine
whether or not echo expands these escape characters by default.
echo does not interpret -- to mean the end of options. echo
interprets the following escape sequences:
...

也就是说bash内建的命令echo不支持--help --version参数的。

所以要想看到--help,--version,可以:

代码: 全选

/bin/echo --help
/bin/echo --version
头像
acer4740
帖子: 1405
注册时间: 2010-09-13 19:04
来自: 0xFF00EE

Re: 钻牛角尖的一个问题: 怎么查看 echo --help

#3

帖子 acer4740 » 2011-10-25 20:04

lz是lzu?
tdounnyy
帖子: 3
注册时间: 2010-05-21 21:52

Re: 钻牛角尖的一个问题: 怎么查看 echo --help

#4

帖子 tdounnyy » 2011-10-25 20:51

受教了! man echo 那句我也看到了,但是没看懂 :em20
头像
退避九舍
帖子: 742
注册时间: 2010-08-08 20:02
系统: Ubuntu 22.04

Re: 钻牛角尖的一个问题: 怎么查看 echo --help

#5

帖子 退避九舍 » 2011-10-28 22:41

代码: 全选

help echo
退避九舍:富贵不能淫,贫贱不能移,威武不能屈:坚持ubuntu不动摇!
回复