> 
> how can I access environment variables? 
> 
ENV[key]

For instance

ENV['TERM']


You'll find a complete discussion of environment variables at

http://www.rubycentral.com/book/rubyworld.html

Regards,
Barry