Created
October 5, 2017 08:03
-
-
Save joltcan/25a4fe53e28833d6eb34bad528ca3af8 to your computer and use it in GitHub Desktop.
SSH completion for known_hosts and config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _own_ssh_known_hosts() { | |
perl -ne 'print "$1 " if /^([\w\d-\.]+).*$/i' ~/.ssh/known_hosts | |
} | |
function _own_ssh_hosts() { | |
perl -ne 'print "$1 " if /^host (.+)$/i' ~/.ssh/config | |
} | |
complete -W "$(_own_ssh_hosts)" ssh | |
complete -W "$(_own_ssh_known_hosts)" ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment