Telnet to a cisco switch

I'm trying to connect to a Cisco Switch and execute a few commands. The
problem is that it's executing only the first telnet.cmd(). To execute
anything else I need to append some command at the end of the first
cmd() (separated by \n). Here is my code:

telnet = Net::Telnet::new("Host" => CISCO,
                          "Timeout" => 10)
telnet.cmd("#{USER}\n#{PASS}") { |c| print c } #works fine
telnet.cmd("help") { |c| print c } #nothing happens

The second cmd() is not working. How do I fix this?

···

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

You need to set a prompt. This is what I use to automate my cisco/f5 stuff.
Feel free to use it.

···

On Tue, May 7, 2013 at 11:38 AM, Rudá G. <lists@ruby-forum.com> wrote:

I'm trying to connect to a Cisco Switch and execute a few commands. The
problem is that it's executing only the first telnet.cmd(). To execute
anything else I need to append some command at the end of the first
cmd() (separated by \n). Here is my code:

telnet = Net::Telnet::new("Host" => CISCO,
                          "Timeout" => 10)
telnet.cmd("#{USER}\n#{PASS}") { |c| print c } #works fine
telnet.cmd("help") { |c| print c } #nothing happens

The second cmd() is not working. How do I fix this?

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

--
vizualize.me/cliffrosson