Can i Use the value of a variable from within a ruby script inside ssh.exec()
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/
puts #{results}
end
How can i use it in the following ssh.exec command
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh| 开发者_Go百科
ssh.exec(#{results})
Something like:
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
results.each{|line| ssh.exec( line)}
end
精彩评论