Michael Bostler wrote in post #1127833:
> Hey Previn,
>
> I think the issue is that the "system" method runs a command in a
> subshell, and therefore your program's executing environment doesn't
> actually ever change
>
> Check out this link for more info:
> http://stackoverflow.com/questions/2232/calling-bash-commands-from-ruby
>
> Maybe you could achieve what you are looking for by wrapping it in
> another ruby script, ie:
>
> Script 1:
> system "source test.csh && ruby script_2.rb"
>
> Script2:
> puts "a = #{ENV['SYSTYPE']}"

Hi Michael,

I did as your suggestion, but get error below.

202 %script_1.rb
./test.csh: line 11: syntax error: unexpected end of file

Then I change the test.csh with only one line as below,
209 %cat test.csh
setenv SYSTYPE "Linux"

then run script_1.rb again, it reports

./test.csh: line 1: setenv: command not found

Would you help check and give suggestion?

Many thanks,
Previn

-- 
Posted via http://www.ruby-forum.com/.