新的 bash 命令有命名约定吗?
Is there a naming convention for new bash commands?
创建包含多个单词的新 Bash 命令时,例如 remove-unused-scripts,是否有通用的命名约定?例如,它应该是 remove-unused-scripts、remove_unused_script、removeUnusedScripts,还是完全不同的东西?
我是 Bash 的新手,只是想确保我没有在早期养成任何坏习惯。
感谢您的宝贵时间。
为了可读性,我认为现在大多数语言推荐 remove_unused_script
而不是 removeUnusedScript
。 remove-unused-scripts
是脚本的合法 file 名称。 bash
允许函数名称包含连字符:
some-func () {
echo hi
}
但这不是便携式的; POSIX 函数名称仅限于字母、数字和 _
.
https://google.github.io/styleguide/shell.xml#Naming_Conventions建议使用小写和一些下划线。您可以阅读完整指南以了解更合理的约定,包括示例。
创建包含多个单词的新 Bash 命令时,例如 remove-unused-scripts,是否有通用的命名约定?例如,它应该是 remove-unused-scripts、remove_unused_script、removeUnusedScripts,还是完全不同的东西?
我是 Bash 的新手,只是想确保我没有在早期养成任何坏习惯。
感谢您的宝贵时间。
为了可读性,我认为现在大多数语言推荐 remove_unused_script
而不是 removeUnusedScript
。 remove-unused-scripts
是脚本的合法 file 名称。 bash
允许函数名称包含连字符:
some-func () {
echo hi
}
但这不是便携式的; POSIX 函数名称仅限于字母、数字和 _
.
https://google.github.io/styleguide/shell.xml#Naming_Conventions建议使用小写和一些下划线。您可以阅读完整指南以了解更合理的约定,包括示例。