You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
354 B

_get_ssh_hosts(){
cat $HOME/.ssh/config | grep '^Host ' | sed "s/Host //"
}
_ssh(){
cur=${COMP_WORDS[COMP_CWORD]}
# prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$(_get_ssh_hosts)" $cur ) )
fi
}
complete -F _ssh -o default ssh
complete -F _ssh -o default scp
# vim:filetype=sh