--===============1386700640==
Content-Type: multipart/alternative;
boundary="_4868531a-c2bb-426c-b649-c522052aefdf_"
--_4868531a-c2bb-426c-b649-c522052aefdf_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
i am sorry to put this 'expect' issue here on perl list. But i searched the=
internet for so long and expect manual too, but couldn't get the cause of =
the following behavior:
i would appreciate all help.
in the following code no matter what the spawned command (ssh <hostname>) s=
ends back (normally a string: Password: ) the last procedure is getting exe=
cuted by the script...
I am so confused it looks a simple code otherwise...
can anyone tell me why is this behaving like that?
##################
# end supporting functions
#################
set host [lindex $argv 0]
set pass [lindex $argv 1]
set prompt "(%|\$|#|>)"
spawn /usr/local/bin/ssh $host
expect {
-re "yes" {
send -- "yes\r"
expect {
-re $prompt { hostok $host }
-re "(P|p)assword:" { sendpass $pass $host $prompt =
}
}
}
-re "(P|p)assword:" {
sendpass $pass $host $prompt
}
-re "$prompt" { hostok $host } <<<This procedure is getting e=
xecuted no matter what
}
exit 0
expect eof
thanks in advance.
-RP
__________________________________________________
There are as many paths as there are travellers...
____________________________________________________________ _____
The best games are on Xbox 360. Click here for a special offer on an Xbox =
360 Console.
http://www.xbox.com/en-US/hardware/wheretobuy/=
--_4868531a-c2bb-426c-b649-c522052aefdf_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style>
..hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
<style>.hmmessage P{margin:0px;padding:0px}body.hmmessage{FONT-SIZE: 10pt;F=
ONT-FAMILY:Tahoma}</style>Hello,<br><br>i am sorry to put this 'expect' iss=
ue here on perl list. But i searched the internet for so long and expect ma=
nual too, but couldn't get the cause of the following behavior:<br><br><br>=
i would appreciate all help.<br><br>in the following code no matter what th=
e spawned command (ssh <hostname>) sends back (normally a string: Pas=
sword: ) the last procedure is getting executed by the script...<br><br>I a=
m so confused it looks a simple code otherwise...<br><br>can anyone tell me=
why is this behaving like that?<br><br>##################<br># end support=
ing functions<br>#################<br><br>set host [lindex $argv 0]<br>set =
pass [lindex $argv 1]<br>set prompt "(%|\$|#|>)"<br><br><br>spawn /usr/l=
ocal/bin/ssh $host<br>expect {<br>  =
; -re "yes" {<br> &nbs=
p; send -- "yes\r"<br>  =
; expect =
{<br> &nbs=
p; -re $p=
rompt { hostok $host }<br> &=
nbsp; &nbs=
p; -re "(P|p)assword:" { sendpass $pass $host $prompt }<br>&nbs=
p; &=
nbsp; }<br> &nbs=
p; &=
nbsp; }<br> -re "(P|p)assword:" {=
<br>  =
; sendpass $pass $host $prompt<br>  =
; }=
<br> -re "$prompt" { hostok $host=
} <<<This procedure is gettin=
g executed no matter what<br>}<br>exit 0<br>expect eof<br><br><br><br><br>t=
hanks in advance.<br><br>-RP<br>___________________________________________=
_______<br>There are as many paths as there are travellers...
<hr />Th=
e best games are on Xbox 360. Click here for a special offer on an Xbox 36=
0 Console. <a href=3D'http://www.xbox.com/en-US/hardware/wheretobuy/' targe=
t=3D'_new'>Get it now!</a></body>
</html>=
--_4868531a-c2bb-426c-b649-c522052aefdf_--
--===============1386700640==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1386700640==--
