-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathProcessBarOfYear.1d.sh
executable file
·32 lines (28 loc) · 1.07 KB
/
ProcessBarOfYear.1d.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
#!/usr/bin/env bash
# Process Bar of Year: Dividing the year into 100 pieces.
#
# by Cnfn (http://github.com/cnfn)
#
# <bitbar.title>Process Bar of Year</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Cnfn</bitbar.author>
# <bitbar.author.github>cnfn</bitbar.author.github>
# <bitbar.desc>Process Bar of Year: Dividing the year into 100 pieces. More info: https://github.com/cnfn/BitBarPlugins/tree/master/ProcessBarOfYear</bitbar.desc>
# <bitbar.image>https://raw.githubusercontent.com/cnfn/grocery/master/images/blog/bitbar_plugin_process_bar_of_year.png</bitbar.image>
# <bitbar.dependencies>bash</bitbar.dependencies>
# <bitbar.abouturl>https://github.com/cnfn/BitBarPlugins/tree/master/ProcessBarOfYear</bitbar.abouturl>
get_total_days_of_year() {
year=$1
if (( !(year % 4) && ( year % 100 || !(year % 400) ) ))
then
echo 366
else
echo 365
fi
}
days_of_year="$(get_total_days_of_year "$(date +%Y)")"
echo "$(echo "$(date +%j) * 100 / $days_of_year" | bc)""%"
echo "---"
echo -n "$(date +%Y) has completed "
echo -n "$(date +%j | bc)"
echo " days"