Is have
bash 中的关键字?或者 bash 补全脚本使用非 bash 的语言吗?
have gcc &&
_gcc()
{
是很常见。看:grep "have .* &&" /etc/bash_completion.d/*
我找不到有关我见过的 bash 完成教程的任何信息,也找不到任何信息man bash
。谷歌搜索“有”也很困难。我在哪里可以找到这方面的文档?
我猜这与确保存在有关gcc
存在于PATH
?
编辑:是的。/etc/bash_completion
包含:
have()
{
unset -v have
# Completions for system administrator commands are installed as well in
# case completion is attempted via `sudo command ...'.
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
have="yes"
}
have
and _have
只是在基础中定义的两个函数bash_completion
文件。在两者之间,它们形成了内置的包装器type
命令来确定特定命令/程序是否可用。
# This function checks whether we have a given program on the system.
#
_have()
{
# Completions for system administrator commands are installed as well in
# case completion is attempted via `sudo command ...'.
PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null
}
# Backwards compatibility for compat completions that use have().
# @deprecated should no longer be used; generally not needed with dynamically
# loaded completions, and _have is suitable for runtime use.
have()
{
unset -v have
_have $1 && have=yes
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)