From: Colin Watson Date: Wed, 9 Mar 2005 13:24:02 +0000 (+0000) Subject: New script to add up numbers on stdin. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=commitdiff_plain;h=6077dddc557b73b7d546d320038cae0cbf539c3f New script to add up numbers on stdin. --- diff --git a/total b/total new file mode 100755 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"