Created
July 13, 2011 21:01
-
-
Save Zettt/1081320 to your computer and use it in GitHub Desktop.
Inserts rounded time (15 minutes). Can be called from, e.g. TextExpander.
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/sh | |
hours=`date "+%H"` | |
let minutes=`date "+%M"` | |
if [[ $minutes -ge 0 ]] && [[ $minutes -le 7 ]]; then | |
minutes="00" | |
elif [[ $minutes -gt 7 ]] && [[ $minutes -le 23 ]]; then | |
minutes="15" | |
elif [[ $minutes -gt 23 ]] && [[ $minutes -le 37 ]]; then | |
minutes="30" | |
elif [[ $minutes -gt 37 ]] && [[ $minutes -le 52 ]]; then | |
minutes="45" | |
elif [[ $minutes -gt 52 ]]; then | |
minutes="00" | |
hours=$(($hours+1)) | |
else | |
return "Error" | |
fi | |
printf "${hours}:${minutes}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment