9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "andrey mirtchovski" <mirtchovski@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net>
Subject: Re: [9fans] environment + functions
Date: Tue,  7 Oct 2008 12:52:43 -0600	[thread overview]
Message-ID: <14ec7b180810071152i1dcdc311la333bfc3e737729d@mail.gmail.com> (raw)
In-Reply-To: <a560a5d00810071131v10aeaba6tfd0f2a7caa91c1f1@mail.gmail.com>

this is a consequence of how environment variables are treated by the
shell and what appears in /env. there is a disconnect between the file
server and the shell (in essence the shell doesn't consult /env upon
each reference. for example if you simply create a file in /env your
current shell won't pick it up as a variable but if you start a new
one it will be there:

9grid% echo $test

9grid% echo -n 'thisisatest' > /env/test
9grid% echo $test

9grid% rc
9grid% echo $test
thisisatest
9grid%

the same way if you just delete a file from /env the shell will not
pick up the deletion:

9grid% echo $test
thisisatest
9grid% rm /env/test
9grid% echo $test
thisisatest
9grid% rc
9grid% echo $test

9grid%

it's done this way, i believe, to ensure that two rc shells running in
the same namespaces do not step all over each others' environments. if
you simply run 'rfork e' before you experiment with all those
functions you won't see the empty files anywhere.

last note: once you've deleted the function with the 'fn' builtin
you're free to remove the corresponding file in /env: it won't matter
anymore. i'm sure rc can be changed to delete the file.


On Tue, Oct 7, 2008 at 12:31 PM, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> Hello,
>
> why after creating a function with
>
> fn my_func_name { something }
>
> and removing this function with
>
> fn my_func_name
>
> a file (though of zero size) exists in /env?
>
> (If I create a lot of functions and then want them be removed, I find a lot
> of for-me-uninteresting files in /env...)
>
> Thanks,
> Ruda
>
>



  parent reply	other threads:[~2008-10-07 18:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07 18:31 Rudolf Sykora
2008-10-07 18:33 ` erik quanstrom
2008-10-07 18:52 ` andrey mirtchovski [this message]
2008-10-08 10:58   ` Rudolf Sykora
2008-10-08 18:46     ` Pietro Gagliardi
2008-10-08 18:52       ` Rudolf Sykora
2008-10-08 19:12         ` erik quanstrom
2008-10-08 19:16         ` Pietro Gagliardi
2008-10-08 19:25           ` Rudolf Sykora
2008-10-08 11:35 erik quanstrom

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=14ec7b180810071152i1dcdc311la333bfc3e737729d@mail.gmail.com \
    --to=mirtchovski@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).