That was a sweet bit of code, I have scripted some in bash and thats 
maybe why the looks like it does :) .

But I have applied the "ruby" style to the code as you suggested and it 
works good for this part:
cmd.each do |c|
  command1 = IO.popen(["plink.exe", "-P", port.to_s, "-pw", pw, 
"#{user}@#{ip}", c]) {|io| io.each {|line|}}
end

so beautiful simple.

but when I get to the part where I want to download the files I get 
stuck:
output.each do |f|
  download = IO.popen(["pscp.exe", "-P", port.to_s, "-pw", pw, 
"#{user}@#{ip}:f"]) {|io| io.each {|line|}}
  puts f
  puts download
end

I have modified it a bit to see what values I have in the variables, but 
the output is abit strange:
If1.cap
#<IO:0x2845d70>
If2.cap
#<IO:0x28456f8>

I store output in a array, so I wounder is a array item always 
surrounded by [item]? Is it possible to show the download in another 
format not IO:0x..... more like the actual command?

Thanks

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