Pan*_*dya 52 bash documentation shell-builtin compgen
来自help compgen:
$ help compgen
compgen: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]
Display possible completions depending on the options.
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.
Run Code Online (Sandbox Code Playgroud)
选项[-abcdefgjksuv]代表什么?
换句话说,我想知道如何使用所有选项。
cuo*_*glm 51
compgen命令的选项与 相同complete,除了-p和-r。从compgen手册页:
compgen
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 standard output
Run Code Online (Sandbox Code Playgroud)
对于选项[abcdefgjksuv]:
-a 表示别名-b 表示 shell 内置函数的名称-c 表示所有命令的名称-d 表示目录名-e 表示导出的 shell 变量的名称-f 表示文件名和函数名-g 表示组名-j 意思是工作名称-k 表示 Shell 保留字的名称-s 指服务名称-u 表示用户别名的名称-v 表示 shell 变量的名称您可以在此处查看完整的手册页。
在 O'Reilly,有一本书(Arnold Robbins 的 bash 快速参考)也有compgen完整描述的提示表单选项。寻找完整的文档提供了上面列出的一些其他选项。它们可能与当前版本无关,但当前版本文档中不再或未描述某些选项。
到目前为止,我已经在网上看到这些大写选项用于调用compgen或在完整文档中提到!
compgen [option] [word]
complete [-abcdefgjksuv] [-o comp-option] [-A action] [-G globpat] [-W wordlist]
[-P prefix] [-S suffix] [-X filterpat] [-F function]
[-C command] name [name ...]
complete -pr [name ...]
Run Code Online (Sandbox Code Playgroud)
一个相当详尽的文档版本可以在Programmable Completion Builtins 中找到。
由于这两个命令都是内置命令,官方文档位于本地bash手册页上。使用搜索选项在其中查找相关部分。抱歉,但在任一视图变体中,即使在 Internet 服务上,布局看起来有些损坏(生成的布局中的可用性降低)。