From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <14ec7b180810071152i1dcdc311la333bfc3e737729d@mail.gmail.com> Date: Tue, 7 Oct 2008 12:52:43 -0600 From: "andrey mirtchovski" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Subject: Re: [9fans] environment + functions Topicbox-Message-UUID: 187f7b06-ead4-11e9-9d60-3106f5b1d025 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 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 > >