Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Last active December 11, 2015 04:28
Show Gist options
  • Save toshimaru/4544762 to your computer and use it in GitHub Desktop.
Save toshimaru/4544762 to your computer and use it in GitHub Desktop.
#!/bin/sh
PS3="Which host? > "
select host in `cat ~/.ssh/config | egrep '^Host' | cut -d ' ' -f 2`; do
[[ $host ]] && {
echo "ssh connect to $host"
ssh $host
break;
}
done
# ~/.ssh/config example
Host myhost1
HostName example.com
User toshi
IdentityFile ~/.ssh/your_id_rsa
Host myhost2
HostName 192.168.xx.xx
User toshi
ProxyCommand ssh myhost1 nc %h %p
ServerAliveInterval 60
ServerAliveCountMax 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment