i have check out many different ways to fix this and it might be specific to the enviroment. i'm creating a script in Ruby to telnet into a remote server, login, enter the shell type (its a prompt after logging in and has no "prompt" in front) and then entering a userid at the next prompt. currently it gets logged in via user and pass, but freezes at the term part. i have tried to use regex, strings, sleep and then just puts("xterm" but nothing allows it to go past this prompt. here is a snippet of code that is getting hung up and the output to go along:
$telnet = Net::Telnet::new("Host" => 'hostname',
"Output_log" => 'output.txt',
"Dump_log" => 'Dump.txt',
"Binmode" => false,
"Timeout" => false,
"Prompt" => /.* $ $/) { |c| print c }
$telnet.login("user", "pass") { |c| print c }
$telnet.waitfor("TERM = (xterm) ")
$telnet.puts("xterm") { |c| print c }
$telnet.waitfor(Match => /Enter\s*$/) { |c| print c }
$telnet.puts("userid")
the output is as follows:
HP-UX ds107492 B.11.11 U 9000/800 (tm)
login: user
Password:
Please wait...checking for disk quotas
. i
.[ci
.*s1^i
See /etc/copyright for copyright notices
You have mail.
'You have mail.'
TERM = (xterm)
seems to be the answer, it allowed me to go past the prompt. still not sure what the difference between this regex and all the others i tried are :/