Amogh Gonwar wrote: > When I execute the command "go" on Telnet, I can either get the: > prompt 1: BDI> (or) > prompt 2: - TARGET: stopped \n BDI> > > When I get prompt 1, I want it to send in the instructions: > "re" > "ci" > "bi 0x000044bc" > "go 0" > > However when i get prompt 2, i want to send in the instructions: > "dump 0x003f7670 128 C:/Dump/atl.dat" > "go". Then I'd say you should still just look for the BDI> prompt as before - because that's when you want to stop reading the response - but check the result from the cmd to see if it contains the string "TARGET: stopped" or not. res = cmd "go 0x003f7670 128 C:/Dump/atl.dat" if res =~ /TARGET: stopped/ cmd "dump " cmd "go 0" else cmd "re" cmd "ci" cmd "bi 0x000044bc" cmd "go 0" end > Based on ur suggestion I modified the code to (also attached): ... > I end up with the error: > C:/load565-released/test.rb:18: syntax error, unexpected tINTEGER, > expecting kEND > dump 0x003f7670 128 C:Dump/atl.dat I think that's because of this construct: bdi.send("Prompt"=>/BDI>/) <<-LOAD_SCRIPT ... LOAD_SCRIPT Imagine you wrote it with a normal string, then you would have the following: bdi.send("Prompt"=>"/BDI/) "re\nci\n" I think it's clear this is nonsense. What you really want is bdi.send(<<-LOAD_SCRIPT, "Prompt"=>/BDI>/) ... LOAD_SCRIPT HTH, Brian. -- Posted via http://www.ruby-forum.com/.