commit 5824576fe911689dfcba9d154926533d21276772
parent 9bef893201f6d09ca38f2b86cf6da9a41c841185
Author: kyle <kyle@getaddrinfo.net>
Date: Mon, 2 Nov 2015 19:45:55 -0700
stats.sh: add mandatory database argument
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/stats.sh b/stats.sh
@@ -1,8 +1,13 @@
#!/bin/ksh
-sql_cmd="sqlite3 /var/db/pricesloth/db"
+if [ $# -ne 1 ]; then
+ echo "usage: ${0} <db>"
+ exit 1
+fi
+
+sql_cmd="sqlite3 ${1}"
-printf "prices: %i\n" $($sql_cmd "select count(*) from prices;")
printf "products: %i\n" $($sql_cmd "select count(*) from products;")
+printf "prices: %i\n" $($sql_cmd "select count(*) from prices;")
printf "descriptions: %i\n" $($sql_cmd "select count(*) from descriptions;")
printf "retailers: %i\n" $($sql_cmd "select count(*) from retailers;")