diff --git a/sh/sum b/sh/sum index 56c1582..c8e50d0 100644 --- a/sh/sum +++ b/sh/sum @@ -4,6 +4,15 @@ # YES_DASH sum() { ### @- + ### compute the summation of its arguments without forking processes. + ### this relies on the shell's built-in arithmetic operators. + ### + ### ``` + ### $ sum 1 2 3 + ### 6 + ### ``` + ### + ### **TODO:** consider renaming because sum(1) already exists. local sum=0 for i; do : $((sum+=i))