forked from jdpedersen1/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuzzytime.sh
executable file
·69 lines (56 loc) · 1.32 KB
/
fuzzytime.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
# Created By: Jake@Linux
# Created On: Sat 16 Jul 2022 11:47:26 AM CDT
# Project: fuzzy clock
box() {
title=" $1 "
edge=$(echo "$title" | sed 's/./*/g')
echo "$edge"
echo -e "\e[1;31m$title\e[0m"
echo "$edge"
}
###--| Array of hours in text form |--###
txtime=("zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve")
hr=$(date +'%I')
min=$(date +'%M')
hr=$(( "10#$hr" ))
min=$(( "10#$min" ))
if (( min >= 33 ))
then
if (( "$hr" == 12 ));
then
hr=1
else
hr=$(( $hr + 1 ))
fi
min=$(( 60 -$min ));
adverb="til"
else
adverb="after"
fi
txthour=${txtime[$hr]}
if (( min < 3 ))
then
written_time="Currently the local time is $txthour o'clock"
elif (( min < 8 ))
then
written_time="Currently it is five min $adverb $txthour"
elif (( min < 13 ))
then
written_time="Currently the time is ten $adverb $txthour"
elif (( min < 18 ))
then
written_time="It is currently fifteen $adverb $txthour"
elif (( min < 23 ))
then
written_time="As of right now the time is twenty $adverb $txthour"
elif (( min < 28 ))
then
written_time="For the moment it is twenty-five $adverb $txthour"
elif (( min < 33 ))
then
written_time="it is currently half past $txthour"
else
exit 1
fi
box "$written_time"