summaryrefslogtreecommitdiffstats
path: root/sum.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sum.sh')
-rwxr-xr-xsum.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/sum.sh b/sum.sh
new file mode 100755
index 0000000..37a7ab2
--- /dev/null
+++ b/sum.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+echo -n "$1"
+
+for i in $*; do
+ if [ ! $i -eq 1 ]; then
+ echo -n " + $i"
+ fi
+ sum=$(($sum + $i))
+done
+
+echo " = $sum"
+