projects
/
platform
/
upstream
/
bash.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Bash-4.3 distribution sources and documentation
[platform/upstream/bash.git]
/
tests
/
nameref8.sub
1
function f1
2
{
3
typeset -n v=$1
4
5
v=inside
6
}
7
8
v=global
9
f1 v
10
echo $v
11
12
unset v
13
unset -f f1
14
15
function foo
16
{
17
typeset x=one
18
19
typeset -n y=$1
20
y=two
21
echo inside: $x
22
}
23
24
foo x
25
echo outside: $x
26
27
function foo2
28
{
29
typeset -n x=$1
30
31
x=foo
32
}
33
34
foo2 x
35
echo $x
36
37
unset -f foo
38
function foo { typeset -n v=$1; v=local; }
39
40
v=global
41
foo v
42
echo $v
43
44
unset v
45
46
# invalid self reference at global scope
47
typeset -n v=v
48
49
# can we catch a circular self-reference?
50
typeset -n v=w
51
typeset -n w=x
52
typeset -n x=v
53
54
x=4
55
echo x = $x
56
57
unset -n v w x