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