[英]How to import Bash functions with the following naming convention: “[module]::[function name]”?
[英]Is there a naming convention for new bash commands?
创建具有多个单词的新Bash命令(例如remove-unused-scripts)时,是否存在通用的命名约定? 例如,它应该是remove-unused-scripts,remove_unused_script,removeUnusedScripts,还是其他完全?
我对Bash很新,只是想确保我不会在早期形成任何坏习惯。
感谢您的时间。
我认为大多数语言remove_unused_script
推荐remove_unused_script
不是removeUnusedScript
以提高可读性。 remove-unused-scripts
是remove-unused-scripts
的合法文件名。 bash
允许函数名包含连字符:
some-func () {
echo hi
}
但那不便携; POSIX函数名称仅限于字母,数字和_
。
https://google.github.io/styleguide/shell.xml#Naming_Conventions建议使用小写和一些下划线。 您可以阅读完整的指南,了解更合理的约定,包括示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.