]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/nameref8.sub
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / nameref8.sub
CommitLineData
ac50fbac
CR
1function f1
2{
3 typeset -n v=$1
4
5 v=inside
6}
7
8v=global
9f1 v
10echo $v
11
12unset v
13unset -f f1
14
15function foo
16{
17 typeset x=one
18
19 typeset -n y=$1
20 y=two
21 echo inside: $x
22}
23
24foo x
25echo outside: $x
26
27function foo2
28{
29 typeset -n x=$1
30
31 x=foo
32}
33
34foo2 x
35echo $x
36
37unset -f foo
38function foo { typeset -n v=$1; v=local; }
39
40v=global
41foo v
42echo $v
43
44unset v
45
46# invalid self reference at global scope
47typeset -n v=v
48
49# can we catch a circular self-reference?
50typeset -n v=w
51typeset -n w=x
52typeset -n x=v
53
54x=4
55echo x = $x
56
57unset -n v w x