On Tue, Nov 19, 2013 at 5:28 AM, Previn Lin <lists / ruby-forum.com> wrote:
> I want to setup a tool, which set the env by source a csh file.
>
> Is there way to source csh env file in Ruby?
>
> For the attached test case, I wrote ruby as below, but seems don't work.
>
> #!/usr/bin/env ruby
>
> system "source test.csh"

The shell cannot read a CSV file that way.  Even if using the output
in Ruby would work that code breaks already in the shell.

> puts "a = #{ENV['SYSTYPE']}"
>
> Your help will be very appreciated.

Use http://ruby-doc.org/stdlib-1.9.3/libdoc/csv/rdoc/CSV.html to
iterate records from CSV file and use ENV.[]= to set environment
variables.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/