1
0
Fork 0

added support for GNU version of date

This commit is contained in:
Nikhil Gupta 2014-10-12 08:30:08 +05:30
parent 96e4e5dd03
commit 71ee0d7b2b

View file

@ -8,21 +8,25 @@
# -----------------------------------------------------------------------------
function emoji-clock() {
hour=$(date -v '+15M' '+%I')
minutes=$(date -v '+15M' '+%M')
# Add 15 minutes to the current time and save the value as $minutes.
(( minutes = $(date '+%M') + 15 ))
(( hour = $(date '+%I') + minutes / 60 ))
# make sure minutes and hours don't exceed 60 nor 12 respectively
(( minutes %= 60 )); (( hour %= 12 ))
case $hour in
01) clock="πŸ•"; [ $minutes -ge 30 ] && clock="πŸ•œ";;
02) clock="πŸ•‘"; [ $minutes -ge 30 ] && clock="πŸ•";;
03) clock="πŸ•’"; [ $minutes -ge 30 ] && clock="πŸ•ž";;
04) clock="πŸ•“"; [ $minutes -ge 30 ] && clock="πŸ•Ÿ";;
05) clock="πŸ•”"; [ $minutes -ge 30 ] && clock="πŸ• ";;
06) clock="πŸ••"; [ $minutes -ge 30 ] && clock="πŸ•‘";;
07) clock="πŸ•–"; [ $minutes -ge 30 ] && clock="πŸ•’";;
08) clock="πŸ•—"; [ $minutes -ge 30 ] && clock="πŸ•£";;
09) clock="πŸ•˜"; [ $minutes -ge 30 ] && clock="πŸ•€";;
0) clock="πŸ•›"; [ $minutes -ge 30 ] && clock="πŸ•§";;
1) clock="πŸ•"; [ $minutes -ge 30 ] && clock="πŸ•œ";;
2) clock="πŸ•‘"; [ $minutes -ge 30 ] && clock="πŸ•";;
3) clock="πŸ•’"; [ $minutes -ge 30 ] && clock="πŸ•ž";;
4) clock="πŸ•“"; [ $minutes -ge 30 ] && clock="πŸ•Ÿ";;
5) clock="πŸ•”"; [ $minutes -ge 30 ] && clock="πŸ• ";;
6) clock="πŸ••"; [ $minutes -ge 30 ] && clock="πŸ•‘";;
7) clock="πŸ•–"; [ $minutes -ge 30 ] && clock="πŸ•’";;
8) clock="πŸ•—"; [ $minutes -ge 30 ] && clock="πŸ•£";;
9) clock="πŸ•˜"; [ $minutes -ge 30 ] && clock="πŸ•€";;
10) clock="πŸ•™"; [ $minutes -ge 30 ] && clock="πŸ•₯";;
11) clock="πŸ•š"; [ $minutes -ge 30 ] && clock="πŸ•¦";;
12) clock="πŸ•›"; [ $minutes -ge 30 ] && clock="πŸ•§";;
*) clock="βŒ›";;
esac
echo $clock