加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

多行bash评论礼仪(#)

发布时间:2020-12-16 01:20:26 所属栏目:安全 来源:网络整理
导读:Advanced Bash-Scripting Guide在示例中大量使用多行注释,形式如下: echo ls -l | sh# Passes the output of "echo ls -l" to the shell,#+ with the same result as a simple "ls -l". (在管道符号的说明中找到).其他多行注释如下所示: #!/bin/bash# rpm-
Advanced Bash-Scripting Guide在示例中大量使用多行注释,形式如下:
echo ls -l | sh
#  Passes the output of "echo ls -l" to the shell,#+ with the same result as a simple "ls -l".

(在管道符号的说明中找到).其他多行注释如下所示:

#!/bin/bash
# rpm-check.sh

#  Queries an rpm file for description,listing,#+ and whether it can be installed.
#  Saves output to a file.
# 
#  This script illustrates using a code block.

(链接页面中的示例3.2).

使用#的ratonale是什么?一些多行评论似乎表明评论在下一行继续,但其他评论则没有.
我是否应该(尝试)遵循我自己的脚本中的“bash-scripting comment ttiquette”?

似乎Advanced Bash脚本编写指南的作者在继续上一行句子的行上使用它.

这不是标准的风格选择;这似乎是Advanced Bash Scripting Guide的作者的风格怪癖.

我将注意到虽然Advanced Bash Scripting Guide中有一些很好的技术信息,但编码风格相当不标准.我不会用它作为好的Bash编码实践的例子.一个更好的资源是Bash FAQ.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读