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?

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