SSH to two addresses, use the one that connects first

view story

http://unix.stackexchange.com – I have a home computer (let’s call it franklin because that’s what I call it) that I often ssh into from my work laptop. When I’m at home, I ssh to franklin.local, and when I’m at work or anywhere else, I ssh to remote.address.of.franklin. I want to have a function in my profile that always connects in the correct way for the situation. My network conditions often change (wired vs. wireless, different SSIDs, etc), so I’d prefer not to do it by detecting the state of the network, but rather: If franklin is available locally, connect locally, else, connect remotely Here’s what I (HowTos)