hi! I'm new to Plan 9 and I don't understand this behavior:

I wrote a program that basically just does
putenv("foo", "bar");

After running it,
echo $foo
prints just an empty line, while
cat /env/foo
prints bar. Can anyone explain?

I asked a somewhat same question a month back
http://9fans.net/archive/2012/05/281

The reason seems to be that while creating a variable foo
in rc is immediately reflected to /env/foo, the reverse is
not true. That is, creating a new file under /env/baz does
not update the current rc instance with a new variable $baz

So in this case, putenv is actually writing to /env/foo,
and it would be visible only if you start a new rc
instance. (or just read from the same file.)

v

Reply via email to