compgen
我想知道选项的含义。help compgen
我可以通过帮助页面获取帮助。但它只显示选项列表。没有解释。
compgen:compgen [-abcdefgjksuv] [-o 选项] [-A 操作] [-G globpat] [-W 单词列表] [-F 功能] [-C 命令] [-X filterpat] [-P 前缀] [-S 后缀] [单词] 根据选项显示可能的补全。
Intended to be used from within a shell function generating possible completions. If the optional WORD argument is supplied, matches against WORD are generated. Exit Status: Returns success unless an invalid option is supplied or an error occurs.
我特别想知道-abcdefgjksuv
论点是如何起作用的。
答案1
在 bash 手册页的底部附近是 SHELL BUILTIN COMMANDS 部分,其中写道
compgen [option] [word]
Generate possible completion matches for word according to the
options, which may be any option accepted by the complete builtin
with the exception of -p and -r, and write the matches to the stan-
dard output. When using the -F or -C options, the various shell
variables set by the programmable completion facilities, while
available, will not have useful values.
The matches will be generated in the same way as if the pro-
grammable completion code had generated them directly from a com-
pletion specification with the same flags. If word is specified,
only those completions matching word will be displayed.
The return value is true unless an invalid option is supplied, or
no matches were generated.
其正下方是complete
解释开关的内置命令。