Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Announce the current hour
- #
- # Use cron to schedule this on the hour:
- # 0 * * * * /path/to/script/chime.sh
- #
- # Change the voice used in System Preferences
- # under Accessibility > Speech
- # 24-hour time for if statements
- HOUR=$(date +%k)
- # Silence from 1am through 9am
- if [ $HOUR -gt 9 ]
- then
- # If past noon, use 12-hour format
- # AM/PM should be obvious
- if [ $HOUR -gt 12 ]
- then
- HOUR=$(date +%l)
- fi
- # Announce hour
- say "Its " $HOUR " o'clock"
- else
- # Instead of hour 0, say midnight
- if [ $HOUR -eq 0 ]
- then
- say "Its midnight"
- fi
- fi
Add Comment
Please, Sign In to add comment