From 39df01fc3c48a4f4ffb3ed0c47c7f58e5597aaa2 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 8 Nov 2020 23:19:18 +0300 Subject: tracking ledger rot function --- .zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.zshrc b/.zshrc index 689539e..1256f2a 100644 --- a/.zshrc +++ b/.zshrc @@ -190,3 +190,15 @@ fi export WECHALLUSER="drocan" export WECHALLTOKEN="35624-0D38B-A2F16-A98B0-5963D-6DF19" + +ledgerrot() { + day=$(tail -n4 ~/nextcloud/ledger.ledger | grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2}') + d1=$(date -d "now" +%s) + d2=$(date -d "$day" +%s) + days=$(( (d1 - d2) / 86400 )) + if [ "$days" -eq "0" ]; then + echo "you good"; + else + echo "$days days"; + fi +} -- cgit v1.2.3-70-g09d2