Bash 用户友好的命令行选项 < >我知道代码> Boo::C++程序代码选项,它使我几乎可以在任何时候编写用户友好的命令行选项。“用户友好”是指短选项和长选项,以及一个描述性帮助命令,看起来类似于: Copy standard input to each FILE, and also to standard output. -a, --append append to the given FILEs, do not overwrite -i, --ignore-interrupts ignore interrupt signals --help display this help and exit --version output version information and exit

Bash 用户友好的命令行选项 < >我知道代码> Boo::C++程序代码选项,它使我几乎可以在任何时候编写用户友好的命令行选项。“用户友好”是指短选项和长选项,以及一个描述性帮助命令,看起来类似于: Copy standard input to each FILE, and also to standard output. -a, --append append to the given FILEs, do not overwrite -i, --ignore-interrupts ignore interrupt signals --help display this help and exit --version output version information and exit,bash,shell,unix,command-line,command-line-arguments,Bash,Shell,Unix,Command Line,Command Line Arguments,就我自己而言,我不得不发现,在bash中,内置的getopts只支持短选项,这真的很尴尬。这是对的还是我错了 您将如何实现用户友好的命令行选项?如果您知道任何链接、最佳实践或深入教程,我将不胜感激。GNU getopt支持长选项,可以从任何类似Bourne或csh的shell中使用。ksh93的内置getopts也支持长选项。zsh有一个zparseopts 有一个POSIX shell实现的getopts(作为一个shell函数),它支持长选项,GNU getopt支持长选项,可以从任何类似B

就我自己而言,我不得不发现,在bash中,内置的
getopts
只支持短选项,这真的很尴尬。这是对的还是我错了


您将如何实现用户友好的命令行选项?如果您知道任何链接、最佳实践或深入教程,我将不胜感激。

GNU getopt支持长选项,可以从任何类似Bourne或csh的shell中使用。ksh93的内置getopts也支持长选项。zsh有一个zparseopts


有一个POSIX shell实现的getopts(作为一个shell函数),它支持长选项,GNU getopt支持长选项,可以从任何类似Bourne或csh的shell中使用。ksh93的内置getopts也支持长选项。zsh有一个zparseopts


有一个getopts的POSIX shell实现(作为一个shell函数),它支持位于

的长选项。感谢您为我指出了正确的信息源

我决定这样做
代码非常简单,因此不需要解释。

感谢您为我指出正确的信息来源

我决定这样做 代码非常简单,因此不需要解释。

请参阅:请参阅: