From: "Tim L." Date: 2012-06-30T05:10:40+09:00 Subject: Re: Ruby pty and expect That was it. thanks a million PTY.spawn("ssh -o StrictHostKeyChecking=no user@#{address}") do |reader, writer, pid| reader.expect(/Password/) writer.puts("my_password") reader.expect(/\$|Password/) do |a, b| if a.match(/\$/) writer.puts("ifconfig") reader.expect(/\$/) writer.puts("exit") reader.expect(/\$/) else Process.kill(9, pid) end end -- Posted via http://www.ruby-forum.com/.