如果我有一个通过 shell 运行的应用程序,是否有 POSIX 文档说 --help
需要支持吗?我会这么认为,因为这似乎是最流行的终端应用程序(GNU 工具等)中的标准做法。
我很好奇我是否可以使用“--help”选项的存在或缺失作为寻找 POSIX 兼容/不兼容命令的试金石。
最佳答案
POSIX 不强制--help
:http://pubs.opengroup.org/onlinepubs/009695399/utilities/ls.html
其实好像POSIX guidelines建议避免不是单个字符的选项(虽然它不被禁止,只是一个指导方针):
Guideline 3: Each option name should be a single alphanumeric character (the alnum character classification) from the portable character set. The -W (capital-W) option shall be reserved for vendor options.
Multi-digit options should not be allowed.
关于posix - --help 标志是 POSIX 标准/建议吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16820245/