We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d50188f commit e976a19Copy full SHA for e976a19
fixtures/bench_accumulator_factory.bash.bug
@@ -0,0 +1,20 @@
1
+#!/bin/sh
2
+# NOTE: disabled because it causes a NPE on a call to root.getChildren() with a non
3
+# null root, reported at: https://github.com/BashSupport/BashSupport/issues/643
4
+accumulator() {
5
+ # Define a global function named $1
6
+ # with a global variable named ${1}_sum.
7
+ eval "${1}_sum=\$2"
8
+ eval "$1() {
9
+ ${1}_sum=\$(echo \"(\$${1}_sum) + (\$2)\" | bc)
10
+ eval \"\$1=\\\$${1}_sum\" # Provide the current sum.
11
+ }"
12
+}
13
+
14
+accumulator x 1
15
+x r 5
16
+accumulator y 3
17
+x r 2.3
18
+echo $r
19
+y r -3000
20
0 commit comments