Fixed SSH completion to include both config and known_hosts. Works on OS X for me...
authorNils Winkler <nils@nilswinkler.com>
Tue, 25 Oct 2011 06:57:39 +0000 (08:57 +0200)
committerNils Winkler <nils@nilswinkler.com>
Tue, 1 Nov 2011 07:27:37 +0000 (08:27 +0100)
completion/available/ssh.completion.bash

index 30fd65d..ea49026 100644 (file)
@@ -13,7 +13,7 @@ _sshcomplete() {
     # parse all hosts found in .ssh/known_hosts
     if [ -r $HOME/.ssh/known_hosts ]; then
         if grep -v -q -e '^ ssh-rsa' $HOME/.ssh/known_hosts ; then
-        COMPREPLY=( $COMPREPLY $(compgen -W "$( awk '{print $1}' $HOME/.ssh/known_hosts | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" -- ${COMP_WORDS[COMP_CWORD]} )) 
+        COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' $HOME/.ssh/known_hosts | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" -- ${COMP_WORDS[COMP_CWORD]} )) 
         fi
     fi