]>
Commit | Line | Data |
---|---|---|
d166f048 JA |
1 | a returns 5 |
2 | b returns 4 | |
3 | c returns 3 | |
4 | d returns 2 | |
5 | in e | |
6 | e returned 25 | |
7 | x is 25 | |
8 | ZZ | |
9 | abcde | |
10 | defghi | |
11 | ZZ | |
12 | 5 | |
13 | 0 | |
14 | AVAR | |
15 | AVAR | |
16 | foo | |
17 | foo | |
18 | AVAR | |
19 | 5 | |
20 | 5 | |
21 | f1 | |
22 | f1 () | |
23 | { | |
24 | ( return 5 ); | |
25 | status=$?; | |
26 | echo $status; | |
27 | return $status | |
28 | } | |
bb70624e | 29 | before: try to assign to FUNCNAME |
3185942a | 30 | outside: FUNCNAME = |
bb70624e JA |
31 | before: FUNCNAME = func |
32 | FUNCNAME = func2 | |
33 | after: FUNCNAME = func | |
34 | outside2: FUNCNAME = | |
35 | function | |
36 | zf is a function | |
37 | zf () | |
38 | { | |
39 | echo this is zf | |
40 | } | |
41 | f is a function | |
42 | f () | |
43 | { | |
44 | echo f-x; | |
45 | echo f-y | |
46 | } 1>&2 | |
47 | subshell | |
48 | f is a function | |
49 | f () | |
50 | { | |
51 | echo f-x; | |
52 | echo f-y | |
53 | } 1>&2 | |
54 | f2 is a function | |
55 | f2 () | |
56 | { | |
57 | echo f2-a; | |
58 | function f3 () | |
59 | { | |
60 | echo f3-a; | |
61 | echo f3-b | |
62 | } 1>&2; | |
63 | f3 | |
64 | } | |
65 | subshell | |
66 | f2 is a function | |
67 | f2 () | |
68 | { | |
69 | echo f2-a; | |
70 | function f3 () | |
71 | { | |
72 | echo f3-a; | |
73 | echo f3-b | |
74 | } 1>&2; | |
75 | f3 | |
76 | } | |
77 | f4 is a function | |
78 | f4 () | |
79 | { | |
80 | echo f4-a; | |
81 | function f5 () | |
82 | { | |
83 | echo f5-a; | |
84 | echo f5-b | |
85 | } 1>&2; | |
86 | f5 | |
87 | } 2>&1 | |
88 | subshell | |
89 | f4 is a function | |
90 | f4 () | |
91 | { | |
92 | echo f4-a; | |
93 | function f5 () | |
94 | { | |
95 | echo f5-a; | |
96 | echo f5-b | |
97 | } 1>&2; | |
98 | f5 | |
99 | } 2>&1 | |
100 | testgrp is a function | |
101 | testgrp () | |
102 | { | |
103 | echo testgrp-a; | |
104 | { | |
105 | echo tg-x; | |
106 | echo tg-y | |
107 | } 1>&2; | |
108 | echo testgrp-b | |
109 | } | |
110 | subshell | |
111 | testgrp is a function | |
112 | testgrp () | |
113 | { | |
114 | echo testgrp-a; | |
115 | { | |
116 | echo tg-x; | |
117 | echo tg-y | |
118 | } 1>&2; | |
119 | echo testgrp-b | |
120 | } | |
28ef6c31 JA |
121 | funca is a function |
122 | funca () | |
123 | { | |
124 | ( echo func-a ) | |
125 | } | |
126 | funcb is a function | |
127 | funcb () | |
128 | { | |
129 | ( echo func-b ) | |
130 | } | |
131 | funcc is a function | |
132 | funcc () | |
133 | { | |
134 | ( echo func-c ) 2>&1 | |
135 | } | |
136 | func-a | |
137 | func-b | |
138 | func-c | |
0001803f CR |
139 | foo-bar |
140 | foo-bar () | |
141 | { | |
142 | : | |
143 | } | |
28ef6c31 JA |
144 | expect 5 10 |
145 | 5 10 | |
146 | expect 20 | |
147 | 20 | |
148 | expect 5 20 | |
149 | 5 20 | |
8868edaf CR |
150 | expect 5 20 |
151 | 5 20 | |
28ef6c31 JA |
152 | expect 2 40 |
153 | 2 40 | |
154 | expect 5 20 | |
155 | 5 20 | |
8868edaf | 156 | ./func4.sub: line 23: foo: maximum function nesting level exceeded (100) |
495aee44 CR |
157 | 1 |
158 | after: f = 100 | |
8868edaf | 159 | ./func4.sub: line 23: foo: maximum function nesting level exceeded (100) |
495aee44 CR |
160 | 1 |
161 | after: f = 100 | |
162 | 7 | |
163 | after FUNCNEST reset: f = 201 | |
164 | 7 | |
165 | after FUNCNEST unset: f = 201 | |
8868edaf | 166 | ./func4.sub: line 23: foo: maximum function nesting level exceeded (20) |
495aee44 CR |
167 | 1 |
168 | after FUNCNEST assign: f = 38 | |
0628567a | 169 | 5 |