Can i Use the value of a variable from within a ruby script inside ssh.exec()

Posted by kamal on Stack Overflow See other posts from Stack Overflow or by kamal
Published on 2010-05-08T12:30:26Z Indexed on 2010/05/08 12:38 UTC
Read the original article Hit count: 161

Filed under:
|

If i have a # {} , like #{results}, in the snippet below:

results = Array.new                                   f = open("/Users/kahmed/messages", "r")                                   f.each_line do |line|                                        results << "#{$.} #{line}" if line =~ /NFE/                                       put #{results}                                   end

How can i use it in the following ssh.exec command

Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|                                   ssh.exec(#{results})

© Stack Overflow or respective owner

Related posts about ruby

Related posts about net-ssh