1 | ## oils_failures_allowed: 2
|
2 |
|
3 | #### Can read from ENV Dict
|
4 | shopt -s ysh:upgrade
|
5 |
|
6 | pp test_ (type(ENV))
|
7 |
|
8 | sh=$[ENV.SH]
|
9 | env -i PATH=$[ENV.PATH] ZZ=zz $sh -c 'echo "ZZ is $[ENV.ZZ]"'
|
10 |
|
11 | ## STDOUT:
|
12 | (Str) "Dict"
|
13 | ZZ is zz
|
14 | ## END
|
15 |
|
16 | #### Temp bindings A=a B=b my-command push to ENV dict
|
17 | shopt -s ysh:upgrade
|
18 |
|
19 | _A=a _B=b env | grep '^_' | sort
|
20 |
|
21 | ## STDOUT:
|
22 | _A=a
|
23 | _B=b
|
24 | ## END
|
25 |
|
26 | #### setglobal ENV.PYTHONPATH = 'foo' changes child process state
|
27 | shopt -s ysh:upgrade
|
28 |
|
29 | setglobal ENV.PYTHONPATH = 'foo'
|
30 |
|
31 | pp test_ (ENV)
|
32 |
|
33 | #export PYTHONPATH=zz
|
34 |
|
35 | # execute POSIX shell
|
36 | sh -c 'echo pythonpath=$PYTHONPATH'
|
37 |
|
38 | ## STDOUT:
|
39 | ## END
|
40 |
|
41 | #### export builtin still works
|
42 | shopt -s ysh:upgrade
|
43 |
|
44 | export PYTHONPATH='foo'
|
45 |
|
46 | #pp test_ (ENV)
|
47 |
|
48 | # execute POSIX shell
|
49 | sh -c 'echo pythonpath=$PYTHONPATH'
|
50 |
|
51 | ## STDOUT:
|
52 | pythonpath=foo
|
53 | ## END
|
54 |
|