Skip to content

Instantly share code, notes, and snippets.

@ecarter
Created April 27, 2010 02:41
Show Gist options
  • Save ecarter/380261 to your computer and use it in GitHub Desktop.
Save ecarter/380261 to your computer and use it in GitHub Desktop.
ssh bash complete using ~/.ssh/config and hosts
complete -C "perl -le '\$p=qq#^\$ARGV[1]#;@ARGV=q#$HOME/.ssh/config#;/\$p/&&/^\D/&&not(/[*?]/)&&print for map{split/\s+/}grep{s/^\s*Host(?:Name)?\s+//i}<>'" ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment