Skip to content

Instantly share code, notes, and snippets.

@skyisle
Created February 18, 2012 01:44
Show Gist options
  • Save skyisle/1856804 to your computer and use it in GitHub Desktop.
Save skyisle/1856804 to your computer and use it in GitHub Desktop.
Shell script to connect icloud host through ssh
#!/bin/bash
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` hostname"
exit $E_BADARGS
fi
HOSTNAME=$1
DOMAIN=$(echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p')
echo "Connecting to :" ${HOSTNAME}.${DOMAIN}"..."
ssh ${HOSTNAME}.${DOMAIN}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment