Created
November 1, 2017 21:53
-
-
Save jeffadams/f62ab7709e58746669b036da6ba92980 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true | |
do | |
OUT=`/usr/bin/pmset -g batt` | |
PERCENTLEFT=`echo $OUT | awk '{print $8}' | sed 's/%;//'` | |
if [ ${PERCENTLEFT} \< 40 ]; | |
then | |
echo "${PERCENTLEFT} percent battery left" > /tmp/batterywarning | |
fi | |
if [ -f /tmp/batterywarning ]; | |
then | |
say -v 'Tessa' -f /tmp/batterywarning | |
rm -f /tmp/batterywarning | |
fi | |
sleep 60 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment