Please have a look at the following simple Ruby statement (tn is
a Net::Telnet object):

tn.login(....)
tn.cmd({'String' => 'uname -n', 'Match' => /root@sb.*# */}) {
  puts "string received:"
  puts str
}

When I run this, I see the result:

string received:
u
string received:
name -n
sb1-1
root@sb1-1:~#

That is, I get the response in two pieces: First the first character
only ("u"), then the rest.

Is there a way to get everything in one piece?

Or might there even be a clever way, which would let me see just
the result of the uname -n command ("sb1-1"), but neither the echoing
of "uname -n", nor the subsequent prompt ("root@sb1-1:~#")? Of
course I can easily extract the required information by myself,
but this seems such a common thing to do (send a command via telnet
and analyze what comes back) that I wonder whether there existed
an easier way to do it.

Ronald



-- 
Ronald Fischer <ronaldf / eml.cc>
Posted via http://www.newsoffice.de/