Guest User

Untitled

a guest
Apr 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #!/bin/bash
  2. # Announce the current hour
  3. #
  4. # Use cron to schedule this on the hour:
  5. # 0 * * * * /path/to/script/chime.sh
  6. #
  7. # Change the voice used in System Preferences
  8. # under Accessibility > Speech
  9.  
  10. # 24-hour time for if statements
  11. HOUR=$(date +%k)
  12.  
  13. # Silence from 1am through 9am
  14. if [ $HOUR -gt 9 ]
  15. then
  16. # If past noon, use 12-hour format
  17. # AM/PM should be obvious
  18. if [ $HOUR -gt 12 ]
  19. then
  20. HOUR=$(date +%l)
  21. fi
  22.  
  23. # Announce hour
  24. say "Its " $HOUR " o'clock"
  25. else
  26. # Instead of hour 0, say midnight
  27. if [ $HOUR -eq 0 ]
  28. then
  29. say "Its midnight"
  30. fi
  31. fi
Add Comment
Please, Sign In to add comment