Added daily and weekly total output

This commit is contained in:
Trey Blancher 2019-01-22 16:57:34 -05:00
parent d8fc352bed
commit cc1b295d6b
1 changed files with 10 additions and 1 deletions

11
chug
View File

@ -1,6 +1,7 @@
#!/bin/bash
WK_OFFSET=$1
WK_TOTAL=0
[[ -z ${WK_OFFSET} ]] && WK_OFFSET=0
DATE=$(gdate -d "last Monday - ${WK_OFFSET} weeks")
for date in $(gdate +%F -d "${DATE}") \
@ -15,9 +16,17 @@ for date in $(gdate +%F -d "${DATE}") \
if [[ -f ${date}.log ]]; then
./do_process $date | less
daily_total=$(./do_process $date | grep -P "Grand total:" | grep -Po "\d+\.\d+")
echo ${daily_total}
else
daily_total=0
echo ${daily_total}
fi
echo
#echo -n Press ENTER for ${date}...
#read
WK_TOTAL=$(bc <<< "scale=2; $WK_TOTAL + $daily_total")
done
echo "Weekly Total: ${WK_TOTAL}"