diff options
| author | Zach DeCook <zachdecook@librem.one> | 2026-09-11 20:44:47 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2026-09-11 20:44:47 -0400 |
| commit | b1c11ecfd4f9b6afffcfadc781de6c62972c1bac (patch) | |
| tree | a955d961d1868697500045861d67254bc75ce88d /budget.sh | |
| download | hledger-b1c11ecfd4f9b6afffcfadc781de6c62972c1bac.tar.gz | |
hledger: Add scripts and rules
Diffstat (limited to 'budget.sh')
| -rwxr-xr-x | budget.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/budget.sh b/budget.sh new file mode 100755 index 0000000..0c3e2fb --- /dev/null +++ b/budget.sh @@ -0,0 +1,36 @@ +#!/bin/sh +file="2025-lmcu-checking-statements.csv" +if test "$1"; then + file="$1" +fi +rules="lmcu-checking.csv.rules" +if test "$2"; then + rules="$2" +fi + +output="$(hledger -f"$file" --rules "$rules" balance --begin "$(date "+%Y-%m-01")")" + +category() { + category="$1" + budget="$2" + amount="$(printf "%s" "$output" | grep "$category" | tr -d ',' | grep -o '[0-9.]*')" + #if test -z $amount; then + printf "%s\t%.2f\t%f\n" "$category" "$amount" "$(python3 -c 'print('$amount' / '$budget')')" + #else + # printf "%s not found.\n" "$category" >/dev/stderr + #fi + +} + +category dining 250 +category groceries 600 +category gas 200 +category shopping 450 +category special 400 +category health 610 #460 + 150 +category mortgage 2934 +category utilities 625 +category charity 450 +category fees 0.01 +output="$(date +%d) date" +category date 31 |
