public
Description: bash scripts, aliases, other misc things go here
Homepage: http://opensource.thinkrelevance.com
Clone URL: git://github.com/relevance/etc.git
Search Repo:
etc / bash / ssh_autocompletion.sh
100644 8 lines (7 sloc) 0.293 kb
1
2
3
4
5
6
7
8
SSH_KNOWN_HOSTS=( $(cat ~/.ssh/known_hosts | \
  cut -f 1 -d ' ' | \
  sed -e s/,.*//g | \
  uniq | \
  egrep -v [0123456789]) )
SSH_CONFIG_HOSTS=( $(cat ~/.ssh/config | grep "Host " | grep -v "*" | cut -f 2 -d ' ') )
 
complete -o default -W "${SSH_KNOWN_HOSTS[*]} ${SSH_CONFIG_HOSTS[*]}" ssh