From: Bob Ford Date: 2013-03-09T01:54:04+09:00 Subject: Re: telnet - how to loop through commands listed in a file I've now run into a little conundrum. There is one command that can take up to 15 seconds to complete so I attempted to put in a simple "if" ========== snippet ========== if #{line} == 'w s' puts "The commands is: #{line}\nWe should be sleeping for 15 seconds\n" telnet.cmd(line.gsub("\"", "")) { |c| print c } sleep 15 else telnet.cmd(line.gsub("\"", "")) { |c| print c } end ========== end snippet ========== The "puts" prints for every single line. The sleep is never encountered. I had placed an exit right under the "puts". The "else" line is the one being executed. I assumed the "puts" the telnet.cmd and then the sleep would only happen if #{line} equaled "w s". Once again I ask you out there what am I doing wrong? -- Posted via http://www.ruby-forum.com/.