allow numbers to end with a comma in the sum command

makes it easier to paste stuff into the terminal
This commit is contained in:
Connor Olding 2022-03-05 17:40:40 -08:00
parent 7d895d20a7
commit 90038bf996
1 changed files with 1 additions and 0 deletions

1
sh/sum
View File

@ -16,6 +16,7 @@ sum() { ### @-
### **TODO:** consider renaming because sum(1) already exists.
local sum=0
for i; do
i="${i%,}"
: $((sum+=i))
done
echo "$sum"