Bash programming/Bash command-line completion
Support for bash completion feature is provided in Debian and Ubuntu distribution by the bash completion
package. Once installed you also usually need to uncomment the following in /etc/bash.bashrc
and/or .bashrc
files to source the bash completion files. The following example is from /etc/bash.bashrc
[1]:
# enable bash completion in interactive shells if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi
MacOS also support autocompletion in bash[2], create or add the following lines to file: ~/.inputrc
set completion-ignore-case on set show-all-if-ambiguous on TAB: menu-complete
If you need autocompletion for your ssh hostname, you should modify your ~./.bash_profile
file [3], using the builtins complete
and compgen
commands or install bash-completion
package.