From: Tomas Mudrunka Date: Mon, 21 Oct 2013 21:05:30 +0000 (+0200) Subject: Better beermeter X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=2f17eaa1223a96dca2f78f29688253e5558236e2;p=mirrors%2FPrograms.git Better beermeter --- 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