From: roger peppe <rogpeppe@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] environment variables
Date: Tue, 24 Nov 2009 11:29:44 +0000 [thread overview]
Message-ID: <df49a7370911240329p341e153au2b5ca468999a4fe0@mail.gmail.com> (raw)
In-Reply-To: <a560a5d00911231424k7cfe7382v7a8339d8cf8376c6@mail.gmail.com>
2009/11/23 Rudolf Sykora <rudolf.sykora@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).
next prev parent reply other threads:[~2009-11-24 11:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 22:24 Rudolf Sykora
2009-11-24 2:33 ` sqweek
2009-11-24 8:34 ` Rudolf Sykora
2009-11-24 11:29 ` roger peppe [this message]
2009-11-24 16:28 ` Rudolf Sykora
[not found] <<a560a5d00911240828q31c106d7rf354f14baa15e2d3@mail.gmail.com>
2009-11-24 18:18 ` erik quanstrom
2009-11-24 18:35 ` Rudolf Sykora
2009-11-25 11:48 ` roger peppe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df49a7370911240329p341e153au2b5ca468999a4fe0@mail.gmail.com \
--to=rogpeppe@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).