From: "M. Edward (Ed) Borasky" Date: 2006-07-31T13:54:27+09:00 Subject: Re: Environment variables with empty value missing from ENV? Clifford Heath wrote: > Under Windows XP (using cygwin's bash, but native Ruby), I > found the following six-legged feature: > > $ ruby -v > ruby 1.8.2 (2004-12-25) [i386-mswin32] Have you tried this with Ruby 1.8.4? What does "which ruby" say? > $ unset FOO; env|grep FOO; ruby -e 'p ENV["FOO"]' > nil > $ FOO= env |grep FOO > FOO= Is this legitimate? I've never seen anyone use this construct ("FOO= ") What happens when you do FOO='' ? > $ FOO= ruby -e 'p ENV["FOO"]' > nil What does ruby -e 'p "" ' do? > $ FOO=xyz ruby -e 'p ENV["FOO"]' > xyz > $ > > The problem is that ENV doesn't contain the key FOO in > the 2nd case, where the value is zero-length. > > What possible justification could there be for this behaviour? 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? > > Clifford Heath. > >