有没有办法从中生成命令的“帮助”或“使用”信息getopt
?
像这样:
ARGUMENTS=$(getopt ... -- "$@")
echo $(help "$ARGUMENTS")
按此格式输出:
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE with -l, scale sizes by SIZE when printing them;