#!/bin/sh
#h http://www.macosxhints.com/article.php?story=20040623231530448
#
#
#
_SCRIPTNAME=sleepmachine
if [ "$1" = "version" ]
	then
	echo "$_SCRIPTNAME by duus"
	echo " puts the machine to sleep 'now' or in 'TIME' seconds "
	else
# --- normal script here ---
#
if [ "$1" != "" ]
	then
	if [ "$1" = "now" ]
		then
		echo "sleep machine NOW"
	else
		echo "sleep machine in $1 seconds"
		sleep $1
	fi
fi
echo "sleeping now ....."
echo | osascript <<EOF
tell application "Finder"
  sleep
end tell
EOF
#
#
#
fi # end 'version'
