Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.