多行bash评论礼仪(#)

前端之家收集整理的这篇文章主要介绍了多行bash评论礼仪(#)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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.

原文链接:https://www.f2er.com/bash/384383.html

猜你在找的Bash相关文章