Skip to content

Instantly share code, notes, and snippets.

@caine
Created November 20, 2012 20:19
Show Gist options
  • Save caine/4120768 to your computer and use it in GitHub Desktop.
Save caine/4120768 to your computer and use it in GitHub Desktop.
getting an icloud id for ssh connection
#!/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