On 06/04/2013 11:30 AM, Thomas Luedeke wrote:
> I've been googling and getting nowhere on this, and I find it an
> extremely confusing topic - the use of environment variables in Ruby,
> compared to UNIX.
>
> I've converted some obsolescent UNIX scripts (used to perform
> verification and validation of computer codes) into Ruby.  I'm now
> running into the problem that I need to set an environment variable on
> the g95 compiler to get the test cases to run correctly.
>
> So in the UNIX script, they use something like "export
> G95_MINUS_ZERO=true".
>
> How in the world do I implement something like this in Ruby?  Is it as
> simple as:
>
> ENV['G95_MINUS_ZERO'] = "true"

Yup.

$ ruby -ve 'ENV["foo"] = "bar"; system "echo $foo"'
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
bar