problem....
am 14.12.2007 04:40:13 von Rajeev Prasad--===============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
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 } <<
}
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
Hello,
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:
=
i would appreciate all help.
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...
I a=
m so confused it looks a simple code otherwise...
can anyone tell me=
why is this behaving like that?
##################
# end support=
ing functions
#################
set host [lindex $argv 0]
set =
pass [lindex $argv 1]
set prompt "(%|\$|#|>)"
spawn /usr/l=
ocal/bin/ssh $host
expect {
 =
; -re "yes" {
&nbs=
p; send -- "yes\r"
 =
; expect =
{
&nbs=
p; -re $p=
rompt { hostok $host }
&=
nbsp; &nbs=
p; -re "(P|p)assword:" { sendpass $pass $host $prompt }
&nbs=
p; &=
nbsp; }
&nbs=
p; &=
nbsp; }
-re "(P|p)assword:" {=
 =
; sendpass $pass $host $prompt
 =
; }=
-re "$prompt" { hostok $host=
} <<<This procedure is gettin=
g executed no matter what
}
exit 0
expect eof
t=
hanks in advance.
-RP
___________________________________________=
_______
There are as many paths as there are travellers...
Th=
e best games are on Xbox 360. Click here for a special offer on an Xbox 36=
0 Console.
t=3D'_new'>Get it now!
=
--_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1386700640==--