1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:29:02 -08:00
rc/sh/sum

15 lines
185 B
Text
Raw Normal View History

2021-07-29 00:37:35 -07:00
#!/usr/bin/env sh
# YES_ZSH
# YES_BASH
# YES_DASH
2021-07-29 00:37:35 -07:00
sum() { ### @-
2021-07-29 00:37:35 -07:00
local sum=0
for i; do
: $((sum+=i))
2021-07-29 00:37:35 -07:00
done
echo "$sum"
}
[ "${SOURCING:-0}" -gt 0 ] || sum "$@"