problem....

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 ) 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 } << 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






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==--

RE: problem....

am 14.12.2007 11:27:43 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Rajeev
Prasad
Sent: 14 December 2007 03:40
To: activeperl@listserv.activestate.com
Subject: problem....

> 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:

expect is essentially tcl, so you might get a better response on a tcl
forum. In fact Activestate host a number of mailing lists concerning
tcl, even one related to expect. For example, see
http://aspn.activestate.com/ASPN/Mail/?topic=3DTcl.

HTH

-- =

Brian Raven =



==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs