#!/bin/bash

# test_comm.sh
#
# Jason Healy
#
# This script attempts to connect to a remote machine using AppleEvents.
# It runs a sample script on the target machine, or reports an error on
# failure.
#

if [ $# != 3 ]; then
    echo "Usage: test_comm.sh <username> <password> <hostname>"
else

    echo "Sending command to ${3} as user ${1}:"

    osascript -l AppleScript -e "tell Application \"Finder\" of machine \"eppc://${1}:${2}@${3}\" to open file \"CommTest\" of folder \"RemoteShutdown\" of startup disk"

fi
