getopt
Parse command-line arguments. More information: https://manned.org/getopt.
- Parse optional
verbose/versionflags with shorthands:
getopt vV verbose,version -- --version --verbose
- Add a
--fileoption with a required argument with shorthand-f:
getopt f: file: -- --file=somefile
- Add a
--verboseoption with an optional argument with shorthand-v, and pass a non-option parameterarg:
getopt v:: verbose:: -- --verbose arg
- Accept a
-rand--verboseflag, a--acceptoption with an optional argument, and add a--targetwith a required argument option with shorthands:
getopt rv::s::t: verbose,source::,target: -- -v --target target
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
