From 2f17eaa1223a96dca2f78f29688253e5558236e2 Mon Sep 17 00:00:00 2001 From: Tomas Mudrunka Date: Mon, 21 Oct 2013 23:05:30 +0200 Subject: [PATCH] Better beermeter --- c/beermeter/beermeter.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/c/beermeter/beermeter.sh b/c/beermeter/beermeter.sh index e6c7e6a..1ff0c1b 100755 --- a/c/beermeter/beermeter.sh +++ b/c/beermeter/beermeter.sh @@ -1,6 +1,7 @@ #!/bin/sh title='Beer-O-Meter' accounts='./accounts' +totals="$accounts/.totals" backend='./audio.sh' tmp="/tmp/beertmp-$$"; dialog=$(which dialog); @@ -23,17 +24,22 @@ servis_menu() { add_account ;; exit) + clear + echo "=== Totals ($totals) ===" + echo + cat "$totals" + echo exit ;; esac } beer_menu() { - echo -n > "$accounts/.totals" + echo -n > "$totals" ls -1 --group-directories-first "$accounts" | while read i; do echo -n "$i"; echo -ne "\x00"; echo -n $(beer_stat "$i"); echo -ne "\x00" - echo -e "$i\t$(beer_stat "$i")" >> "$accounts/.totals" + echo -e "$i\t$(beer_stat "$i")" >> "$totals" done | xargs -0 $dialog --menu "$title stamgasti" 0 0 0 } @@ -42,6 +48,7 @@ main_menu() { beer_menu 2>"$tmp" [ "$?" = "0" ] && { stamgast="$(cat "$tmp")" + clear echo == Cepuje stamgast $stamgast, ukonci ctrl+c == "$backend" | tee -a "$accounts/$stamgast" true -- 2.30.2