auto-ssh-hosts.zsh 348 B

12345678910111213141516
  1. #
  2. # Automagic ssh to known hosts.
  3. # Thanks to:
  4. # https://github.com/dangerous/dotfiles
  5. # Works in conjunction with .ssh/config for username@hostname
  6. #
  7. ## hosts file
  8. alias hosts='sudo vim /etc/hosts'
  9. local _myhosts
  10. _myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
  11. for host in $_myhosts; do
  12. alias $host="ssh $host"
  13. done