Skip to content

Instantly share code, notes, and snippets.

@preaction
Created April 14, 2011 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save preaction/920561 to your computer and use it in GitHub Desktop.
Save preaction/920561 to your computer and use it in GitHub Desktop.
# Autocomplete for ssh hostnames
_compssh ()
{
cur=${COMP_WORDS[COMP_CWORD]};
COMPREPLY=($(compgen -W '$(sed -e "s/,.*$//" ${HOME}/.ssh/known_hosts )' -- $cur))
}
complete -F _compssh ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment