blob: b3c342ca8e7e368536b7df812e108800a08ddd9f (
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
|
# test whether or not temporary environment assignments are exported
# in posix mode. works now, posix says it will not work in the future
show2()
{
printf %s "foo=${foo-<unset>}"
echo -n ' environment foo='
printenv foo || echo
}
showfoo()
{
local foo
foo=showfoo show2
}
unset foo
showfoo
foo=foo showfoo
showfoo
echo outside: "foo=${foo-<unset>}"
echo ; echo 'posix mode'
set -o posix
unset foo
showfoo
echo outside 1.0: "foo=${foo-<unset>}"
foo=foo showfoo
showfoo
echo outside 1.1: "foo=${foo-<unset>}"
unset foo
show2
echo outside 2.0: "foo=${foo-<unset>}"
foo=foo show2
show2
echo outside 2.1: "foo=${foo-<unset>}"
|