Created
December 24, 2015 01:00
-
-
Save patorash/377268ef75f012318279 to your computer and use it in GitHub Desktop.
fishにて、pecoを使って~/.ssh/configの情報を元にsshの接続先を選択可能にしたやつ
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 peco_ssh | |
awk ' | |
tolower($1)=="host" { | |
for(i=2;i<=NF; i++) { | |
if ($i !~ "[*?]") { | |
print $i | |
} | |
} | |
} | |
' ~/.ssh/config | sort | peco | read -l hostname | |
if test -n "$hostname" | |
ssh $hostname | |
end | |
end | |
alias s "peco_ssh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment