开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜