title: Exporting an Environment Variable in Ruby
body: <p>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 <code>read</code> Bash builtin:</p>
  
  <pre><code>#!/usr/bin/ruby
  
  varname = ARGV[0]
  ENV[varname] = STDIN.gets  # but have varname exported to the parent process
  </code></pre>