repo.or.cz
/
bash.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Added gitignore entries needed to ignore derived objects generated from full build...
[bash.git]
/
tests
/
func3.sub
blob
9d3d06943088a40aa24519088fac34022bca2ba3
1
#
2
# test some posix-mode-specific function behavior
3
#
4
set -o posix
5
func()
6
{
7
return 5
8
}
9
10
myfunction () {
11
var=20 return
12
}
13
var=10
14
echo expect 5 10
15
func
16
echo $? $var
17
18
myfunction
19
echo expect 20
20
echo $var
21
22
echo expect 5 20
23
func
24
echo $? $var
25
26
echo expect 5 30
27
var=30 func
28
echo $? $var
29
30
: ${TMPDIR:=/tmp}
31
TMPFILE=$TMPDIR/func3.sub.$$
32
33
rm -f $TMPFILE
34
echo 'var=40 return 2' > $TMPFILE
35
36
# test the behavior of `return' and preceding variable assignments here
37
# because it's convenient
38
var=10
39
echo expect 2 40
40
. $TMPFILE
41
echo $? $var
42
43
rm -f $TMPFILE
44
45
#set -o posix
46
var=0
47
func()
48
{
49
var=20 return 5
50
}
51
52
echo expect 5 20
53
var=30 func
54
echo $? $var