Exporting an Environment Variable in Ruby

Posted by wilhelmtell on Stack Overflow See other posts from Stack Overflow or by wilhelmtell
Published on 2010-04-18T00:08:39Z Indexed on 2010/04/18 0:13 UTC
Read the original article Hit count: 158

Filed under:
|

How do I export an environment variable from within a Ruby script to the parent shell? For example, implementing a naïve implementation of the /usr/bin/read utility:

#!/usr/bin/ruby

varname = ARGV[0]
ENV[varname] = STDIN.gets  # but have varname exported to the parent process

© Stack Overflow or respective owner

Related posts about ruby

Related posts about environment-variables