2009/11/23 Rudolf Sykora <rudolf.syk...@gmail.com>:
> Hello,
>
> If I have an rc script and I don't specify any rfork in it, then the
> namespace and the environment should be shared.
> So, having an 'a' script
>
> #!/bin/rc
> a = hello
> cd c   #later on...
>
> and a 'b' script:
>
> #!/bin/rc
> a
> echo $a
>
> and running the 'b' script, I'd expect that the 'a' variable would be set to
> 'hello' and written out. But it does not work like that, thanks to some
> caching or what. How should the 'b' script, or whatever, be corrected so
> that it work?

yes, rc caches the values of its environment variables
to avoid reading all the values after every command is run.

if you want to re-get the value of an environment variable,
you can do:

ifs=() var=`{cat /env/var}

> Further, I am now a bit puzzled about whose property the 'current directory'
> is. Why isn't the directory changed to 'c' after runing either the 'a' or
> 'b' script? Is this always a local property of each shell?

in plan 9 the current working directory is per-process
(inferno is different here - it's part of the current name space).

Reply via email to