From: Curt Sampson Date: 2006-11-25T13:38:11+09:00 Subject: Re: setting environment variables... On Sat, 25 Nov 2006, dc wrote: > I tried to do some research on what exactly ENV is, within ruby, but > didnt get much out of google...its a bit too common of a word. Check Pixaxe. Even the on-line 1st edition should have a good discussion of ENV. > if i just call system() to set an env flag, > then export it > will it then be available to other processes? Under Unix, the environment is a set of keywords and associated values available to the current process. When you fork a new process (creating a child process), it inherits a COPY of the environment of the parent process. system forks a new child process. So that child, if it sets an environment variable will have access to it, as will all of its children. The parent (your ruby script) will not be affected, nor will any other processes that are not children of the child that set the environment variable. Probably best thing to do would be to find something somewhere that explains the Unix process model; once you understand that, simple reasoning will let you figure out what's going on and what you need to do. Oh, and changing ENV does indeed change the environment of the current process: $ cat z system('echo before: $FOO') ENV['FOO'] = "now it's set" system('echo after: $FOO') $ ruby z before: after: now it's set $ cjs -- Curt Sampson +81 90 7737 2974 The power of accurate observation is commonly called cynicism by those who have not got it. --George Bernard Shaw