Here's one way to do this with the standard "dc" (RPN calculator) utility:
echo "1\n2\n3\n+\n+\np\n" | dc -
Or, a little more legibly:
> dc
1
2
3
+
+
p
6
[Edited to fix bug]
Not sure how to automate this to sum 1000 values without needing to explicitly insert 999 + signs, though. Haven't explored dc in depth myself yet. There's probably some way to do it with a macro or something, but it may not be pretty.
Not sure how to automate this to sum 1000 values without needing to explicitly insert 999 + signs, though. Haven't explored dc in depth myself yet. There's probably some way to do it with a macro or something, but it may not be pretty.