added support for GNU version of date
This commit is contained in:
parent
96e4e5dd03
commit
71ee0d7b2b
1 changed files with 16 additions and 12 deletions
|
@ -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
|
||||
|
|
Loadingβ¦
Reference in a new issue