From: Bob Ford Date: 2013-03-01T06:24:09+09:00 Subject: telnet - how to loop through commands listed in a file Let me first explain what I'm trying to do. I have written a very simplistic ruby telnet script. It logs in and can send one command I give from the command line. What I need, or want, to do is have a file which contains multiple commands I would like to have executed on the switch I am connecting to via telnet. The script and a sample of the file are attached. I currently have not removed the command line argument for passing in the telnet command but it is not used so using a -c "nothing" gets me past that. If and when I can get the source file working I will change that for naming the file. I get a failure in the for loop "C:Ruby Scripts/Telnet.rb:54:in `
': undefined method `each' for # (NoMethodError) If I enter a telnet.cmd line for each command it works but then it limits the flexibility of being able to have multiple files with different commands. Thank you for any assistance. It would be greatly appreciated. Attachments: http://www.ruby-forum.com/attachment/8185/TelnetCmds.rb http://www.ruby-forum.com/attachment/8186/CMDs.txt -- Posted via http://www.ruby-forum.com/.