Environmental variables in Ruby 1.8.5

I get:
irb(main):001:0> ENV.keys.size
=> 15
irb(main):002:0> ENV.keys[0…14]
=> [“TERM_PROGRAM”, “TERM”, “SHELL”, “CLICOLOR”,
“TERM_PROGRAM_VERSION”, “USER”, “__CF_USER_TEXT_ENCODING”, “PATH”,
“RI”, “PWD”, “SHLVL”, “HOME”, “LOGNAME”, “SECURITYSESSIONID”, “_”]

Which is a smaller set of environmental variables quite different
than what is described in the Pickaxe Book. Did the Ruby powers trim
them? Just curious.

$ env | wc -l
23
$ ruby -e ‘puts ENV.size’
23

It is your environment ruby is seeing

may I demonstrate

robert@PC:~/mirrors 19:22:04
255/36 > ruby -e ‘p ENV[“xxx”]’
nil
robert@PC:~/mirrors 19:22:28
256/37 > xxx=“set now” ruby -e ‘p ENV[“xxx”]’
“set now”
robert@PC:~/mirrors 19:22:44

Hope that helps
Robert

On 8/28/06, Kent S. [email protected] wrote:

=> 15
Conscience is thoroughly well-bred and soon leaves off talking to
Kent


http://www.datanoise.com

Ah I see Kent, that was a very clever and concise way to show your
point.
So clever I failed to see it :frowning:

Cheers
Robert

Deux choses sont infinies : l’univers et la bêtise humaine ; en ce qui
concerne l’univers, je n’en ai pas acquis la certitude absolue.

  • Albert Einstein

On Aug 28, 2006, at 10:14 AM, Kent S. wrote:

$ env | wc -l
23
$ ruby -e ‘puts ENV.size’
23

Thanks Kent,
I get it now.