From: x1 Date: 2006-11-25T11:55:41+09:00 Subject: Re: setting environment variables... agreed. Works on win32 also: irb#1(main):011:0> ENV['time'] = Time.now.to_s and system('set|find "time"') time=Fri Nov 24 21:55:23 -0500 2006 => true On 11/24/06, El Gato wrote: > Paul Lutus wrote: > > ara.t.howard@noaa.gov wrote: > > > > / ... > > > >>> You cannot do this. > >> > >> why not? > >> > >> harp:~ > ruby -e' ENV["VAR"] = 42.to_s; system "env|grep VAR" ' > >> VAR=42 > >> > >> the environment is definitely shared. did i mis-understand? > > > > My reply was based on his diagrammed effort to use one system call to > > refer > > to another system call: > > > >>> if i use (in ruby app:) > >>> system(" RSWF_C=1; export RSWF_C" ) > > > >>> is this available to all other scripts called from this > >>> master ruby script? > > > > The answer is obvious, and I provided it. > > > > If instead his goal can be met by setting ENV variables within Ruby, > > then > > that solves the problem. But before suggesting this, I asked that the OP > > first explain what he is trying to do. > > > Gee, I thought it was quite obvious that he was trying to export a shell > variable. Was it not at least somewhat obvious to you? His first > paragraph was relatively straightforward about that. Anyways, my point > is that you probably could've just gone ahead and given him the answer > -- it would've added a mere 20 chars (max) to your post and been at > least 100 times more helpful. I dread the day when all of the Ruby hype > turns this community into the elitist/hostile environment that exists > for so many other languages. > > -- > Posted via http://www.ruby-forum.com/. > >