diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-21 21:23:19 +0100 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-21 21:23:19 +0100 |
commit | a37c7b0f4e4d839a20dc95b21063437de8ea83ee (patch) | |
tree | 4d09600585dbaff0d3df671532fdeba9299a6a88 | |
parent | 48e494a6b8406382a4873adee3f42dbde050f754 (diff) |
Added daypercentage
-rwxr-xr-x | modules/daypercentage | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/daypercentage b/modules/daypercentage new file mode 100755 index 0000000..0b7b426 --- /dev/null +++ b/modules/daypercentage @@ -0,0 +1,13 @@ +#!/bin/bash + +# Prints the percentage of the day that has been completed + +PREFIX=' ' + +get_daypercentage() +{ + MINUTES="$[$(date +%R | cut -d ':' -f1) * 60 + $(date +%R | cut -d ':' -f2) ]" + echo "$PREFIX$(echo $[ $MINUTES * 100 / 1440 ] | sed 's/\..*//g')%" +} + +get_daypercentage |