chiark / gitweb /
New script to add up numbers on stdin.
[bin.git] / total
diff --git a/total b/total
new file mode 100755 (executable)
index 0000000..fe1c143
--- /dev/null
+++ b/total
@@ -0,0 +1,7 @@
+#! /bin/sh -e
+
+total=0
+for num in $(cat); do
+       total="$(($total + $num))"
+done
+echo "$total"