Debian Codegraph @

recursion-demo.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # recursion-demo.sh
3 # Demonstration of recursion.
4
5 RECURSIONS=9 # How many times to recurse.
6 r_count=0 # Must be global. Why?
7
8 recursescip-shell shell abs-guide 10-4 recurse(). ()
9 {
10 var="$1"
11
12 while [scip-shell system . . `[`. "$var" -ge 0 ]
13 do
14 echoscip-shell system . . echo. "Recursion count = "$r_count" +-+ \$var = "$var""
15 (( var-- )); (( r_count++ ))
16 recursescip-shell shell abs-guide 10-4 recurse(). "$var" # Function calls itself (recurses)
17 done #+ until what condition is met?
18 }
19
20 recursescip-shell shell abs-guide 10-4 recurse(). $RECURSIONS
21
22 exit $?