Skip to content

Instantly share code, notes, and snippets.

@Velrok
Created October 30, 2013 00:28
Show Gist options
  • Save Velrok/7225196 to your computer and use it in GitHub Desktop.
Save Velrok/7225196 to your computer and use it in GitHub Desktop.
A bash script for mac that uses an apple script to put the mac to sleep without the need to enter the password.
#!/bin/bash
if [ -n "$1" ]
then
minutes=$(($1 * 60))
echo "going to sleep in $1 minutes"
sleep $minutes
fi
echo "sleeping now"
osascript -e 'tell app "Finder" to sleep'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment