shell脚本中的多行注释 - 了解详细信息或文档

时间:2014-01-06 07:39:56

标签: shell comments

搜索选项后,我知道我们可以在:<<的脚本中添加多行注释,但我没有在手册页中看到它。

$ :<<'SCRIPT_DOCU'
> my detailed documentaion here. ..
> multi-lined : can go here
> .
> .
> SCRIPT_DOCU

man page并没有引导我找到我想要的东西:

man "\:\<\<"

man bash | grep "\:\<\<"

我们如何了解* unix环境中提供的此类选项?它可以被一些null命令解释,因为它以:开头(在命令行上输入:并且命中输入不会做任何事情)。

经过一些更多的发现之后,很少有像这样的选项:http://tldp.org/LDP/abs/html/abs-guide.html#COMMENTH(虽然它不允许我在第二行使用#+)或者用躲避单引号解释的东西

__='
something here
more of that. ..
'

请告诉我上述案例中的上述选项或shell解释。

1 个答案:

答案 0 :(得分:0)

: is Shell Builtin Command

Unless otherwise noted, each builtin command documented in this section as accepting options preceded by - accepts -- to signify the end of the options. The :, true, false, and test builtins do not accept options and do not treat -- specially. The exit, logout, break, continue, let, and shift builtins accept and process arguments beginning with - without requiring --. Other builtins that accept arguments but are not specified as accepting options interpret arguments beginning with - as invalid options and require -- to prevent this interpretation.

: [arguments]
No effect; the command does nothing beyond expanding arguments and performing any specified redirections. A zero exit code is returned.

换句话说,:是什么都不做。但是在您的示例中,它仅显示脚本中的菜单供您参考(在&lt;&lt;&lt;)之后

相关问题