M. Edward (Ed) Borasky wrote:
On Gentoo Linux:
Yes, that’s the way it should work. Same on Debian with 1.8.4
It’s a bug on ruby/windows (I haven’t tried 1.8.4), because:
$ export FOO=
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.
Environment variable BAR not defined
So Windows, like *nix, knows that the environment variable is
set and that it has an empty value. I need to detect this in
Ruby the same as on Linux.
Is this legitimate? I’ve never seen anyone use this construct ("FOO= ")
It’s a shorthand way of saying “(export FOO=; command …)”, i.e.
export a value for an environment variable just for this command.
What happens when you do FOO=’’ ?
Exactly the same as not using ‘’, as you’d expect.
What does ruby -e 'p “” ’ do?
just as expected, of course.
I’m not sure … is this construct useful to you in some way? Setting
an environment variable to an empty string and reading it in Ruby?
Absolutely. The variable provides an alternative to an internal default
value, and if it’s set, I want to use it by saying (ENV[“FOO”] ||
Works on Linux, breaks on Windows, contrary to Window’s own rules.