Better beermeter
authorTomas Mudrunka <tomas@mudrunka.cz>
Mon, 21 Oct 2013 21:05:30 +0000 (23:05 +0200)
committerTomas Mudrunka <tomas@mudrunka.cz>
Mon, 21 Oct 2013 21:05:30 +0000 (23:05 +0200)
c/beermeter/beermeter.sh

index e6c7e6a686ce9c49aa16c3650e8dc57fd019f1d0..1ff0c1ba6b7ab193ad9962bed4bb29314875d097 100755 (executable)
@@ -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
This page took 0.171128 seconds and 4 git commands to generate.