Discussion:
[9fans] 9fans Digest, Vol 98, Issue 15
(too old to reply)
Friedrich Psiorz
2012-06-08 23:44:28 UTC
Permalink
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.)
Ok, so I got the whole idea wrong, I guess. I thought that $var is
basically just syntactic sugar for `{cat /env/var}, so referencing a
variable would always read from /env ...
I don't really understand how and why this is not the case though, but
I'll try to find out by reading a few more manpages ...
Lyndon Nerenberg
2012-06-08 23:51:35 UTC
Permalink
Post by Friedrich Psiorz
I don't really understand how and why this is not the case though, but
I'll try to find out by reading a few more manpages ...
rc caches environment variables. It saves a read(2) every time $foo is referenced. Whether that's a win these days is unknown and deserves a bit of research. Or maybe rc could grow a command that flushes the env cache.

--lyndon
erik quanstrom
2012-06-09 00:15:45 UTC
Permalink
Post by Friedrich Psiorz
Ok, so I got the whole idea wrong, I guess. I thought that $var is
basically just syntactic sugar for `{cat /env/var}, so referencing a
variable would always read from /env ...
I don't really understand how and why this is not the case though, but
I'll try to find out by reading a few more manpages ...
it would then make sense to say $./fu. an idea i first heard
from mike haertel.

- erik

Continue reading on narkive:
Loading...