chiark
/
gitweb
/
~cjwatson
/
bin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
60a66c6
)
New script to add up numbers on stdin.
author
Colin Watson
<cjwatson@chiark.greenend.org.uk>
Wed, 9 Mar 2005 13:24:02 +0000
(13:24 +0000)
committer
Colin Watson
<cjwatson@chiark.greenend.org.uk>
Wed, 9 Mar 2005 13:24:02 +0000
(13:24 +0000)
total
[new file with mode: 0755]
patch
|
blob
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"