title: Accessing the return value of a ruby script in shell
body: <p>How do I access the value of variable <code>a</code> in <code>test1.rb</code> to use further in <code>test1.rb</code> outside <code>SSH</code>?</p>
  
  <p>In <code>test1.rb</code></p>
  
  <pre><code>Net::SSH.start("host", ava) do |ssh|
     ssh.exec('ruby test2.rb')
  end
  </code></pre>
  
  <p>In <code>host</code>, <code>test2.rb</code></p>
  
  <pre><code>#!/usr/bin/env ruby
  
  class Value
    def get_value()
      a = 1 + 2
    end
  end
  
  v = Value.new
  v.get_value()
  </code></pre>