gpt4 book ai didi

bash - 检测 bash 中是否存在 Bash 补全

转载 作者:行者123 更新时间:2023-11-29 09:15:07 39 4
gpt4 key购买 nike

如何检测我的 bash shell 中是否加载了 bash 补全包?从 bash-completion 的 2.1 版(包含在 Debian 8 中)开始,除了 BASH_COMPLETION_COMPAT_DIR 之外没有任何 shell 变量来指示这一点,这不是一个可靠的指示符。

最佳答案

您可以使用 the complete command使用 -p 选项获取所有或特定完成的列表。我也不确定这有多可靠,因为您可以随意加载和卸载它们。

complete -p

另一种选择是检查 one of the more unique function namesthe type command看看它是否是一个函数。

type -t _get_comp_words_by_ref

This question and answer也可以提供一些见解。

关于bash - 检测 bash 中是否存在 Bash 补全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35921748/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com