- bash启动的时候,会加载
/etc/bash_completion.d
中的文件,并执行. /etc/bash_completion
ls /etc/bash_completion.d
git-prompt
cat dothis
#/usr/bin/env bash _dothis_completions() { COMPREPLY+=("now") COMPREPLY+=("tomorrow") COMPREPLY+=("never") } complete -F _dothis_completions dothis
sudo cp dothis /etc/bash_completion.d/
sudo cp dothis /bin
bash
dothis <tab><tab>
never now tomorrow