470,591 Members | 2,166 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

Using Expect output in a script.

I'm unsure how to break down and use what is returned by expect in the
rest of my script. I want to issue a command and split the results of
that command into several different variables. I then want to use
those variables in the rest of my script. Here is a snipet:

$expcxn = Expect->spawn("telnet 10.10.10.10\r") or die "Cannot spawn
telnet: $!\n\n";
$expcxn->expect($timeout, "assword:") or die "Did not get a password
prompt: $!/n/n";
print $expcxn "thepassword\r";
$expcxn->expect($timeout, "go>") or die "Did not get command prompt:
$!/n/n";
print $expcxn "show info $ARGV[0]\r";
$expcxn->expect($timeout, "go>") or die "Did not get command prompt:
$!/n/n";
exit(-1);

The 'show info' command is what produces the info I want to split and
use. What do I have to do to get whatever is returned and put it into
variables I can use in other commands?
Jul 19 '05 #1
0 3973

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Tobias Hesselmann | last post: by
12 posts views Thread by Mark Constant | last post: by
reply views Thread by Krutibas Biswal | last post: by
3 posts views Thread by Dr. Oz | last post: by
121 posts views Thread by typingcat | last post: by
7 posts views Thread by C.Joseph Drayton | last post: by
83 posts views Thread by liketofindoutwhy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.