From: Ramprasad A Padmanabhan on
Hi all,

I am sorry if this is OT. I am recording a telnet session in
autoexpect , but any commands executed on the remote machine are not
recorded.

For eg

[ram(a)indl253ga ram]$ autoexpect telnet ram
autoexpect started, file is script.exp
Trying 152.69.188.253...
Connected to indl253ga.idc.oracle.com (152.69.188.253).
Escape character is '^]'.
Red Hat Enterprise Linux AS release 3 (Taroon)
Kernel 2.4.21-4.EL on an i686
login: ram
Password:
Last login: Thu Feb 17 14:00:45 from indl253ga
You have new mail.
[ram(a)indl253ga ram]$ ls -l /etc/passwd
-rw-r--r-- 1 root root 2521 Dec 30 12:42 /etc/passwd
[ram(a)indl253ga ram]$ exit
Connection closed by foreign host.
autoexpect done, file is script.exp

-----------------------
But if I run script.exp on command line again the
ls -l doesnt execute



[ram(a)indl253ga ram]$ ./script.exp
spawn telnet ram
Trying 152.69.188.253...
Connected to indl253ga.idc.oracle.com (152.69.188.253).
Escape character is '^]'.
Red Hat Enterprise Linux AS release 3 (Taroon)
Kernel 2.4.21-4.EL on an i686
login: ram
Password:
Last login: Thu Feb 17 14:01:16 from indl253ga
You have new mail.
[ram(a)indl253ga ram]$

--------------------- Just Hangs here Until I ^C and expect terminates



This is my environment
I am using a compiled version of expect 5.4.2 on redhat AS 3

Thanks
Ram


From: Cameron Laird on
In article <UUYQd.5$B47.63(a)news.oracle.com>,
Ramprasad A Padmanabhan <ramprasad.padmanabhan(a)oracle.com> wrote:
>Hi all,
>
> I am sorry if this is OT. I am recording a telnet session in
>autoexpect , but any commands executed on the remote machine are not
>recorded.
>
>For eg
>
>[ram(a)indl253ga ram]$ autoexpect telnet ram
>autoexpect started, file is script.exp
>Trying 152.69.188.253...
>Connected to indl253ga.idc.oracle.com (152.69.188.253).
>Escape character is '^]'.
>Red Hat Enterprise Linux AS release 3 (Taroon)
>Kernel 2.4.21-4.EL on an i686
>login: ram
>Password:
>Last login: Thu Feb 17 14:00:45 from indl253ga
>You have new mail.
>[ram(a)indl253ga ram]$ ls -l /etc/passwd
>-rw-r--r-- 1 root root 2521 Dec 30 12:42 /etc/passwd
>[ram(a)indl253ga ram]$ exit
>Connection closed by foreign host.
>autoexpect done, file is script.exp
>
>-----------------------
>But if I run script.exp on command line again the
>ls -l doesnt execute
>
>
>
>[ram(a)indl253ga ram]$ ./script.exp
>spawn telnet ram
>Trying 152.69.188.253...
>Connected to indl253ga.idc.oracle.com (152.69.188.253).
>Escape character is '^]'.
>Red Hat Enterprise Linux AS release 3 (Taroon)
>Kernel 2.4.21-4.EL on an i686
>login: ram
>Password:
>Last login: Thu Feb 17 14:01:16 from indl253ga
>You have new mail.
>[ram(a)indl253ga ram]$
>
>--------------------- Just Hangs here Until I ^C and expect terminates
>
>
>
>This is my environment
>I am using a compiled version of expect 5.4.2 on redhat AS 3
.
.
.
Verrrrrrrry strange. You're doing exactly the right things;
I sure don't see the problem. In particular, I have no reason
to suspect timing problems, as you're already through to the
command line on indl253ga.

My next step would be to turn up debugging <URL:
http://wiki.tcl.tk/DebuggingExpect > and see what turns up.
From: Bruce Hartweg on

Ramprasad A Padmanabhan wrote:

> Hi all,
>
> I am sorry if this is OT. I am recording a telnet session in
> autoexpect , but any commands executed on the remote machine are not
> recorded.
>
> For eg
>
> [ram(a)indl253ga ram]$ autoexpect telnet ram
> autoexpect started, file is script.exp
> Trying 152.69.188.253...
> Connected to indl253ga.idc.oracle.com (152.69.188.253).
> Escape character is '^]'.
> Red Hat Enterprise Linux AS release 3 (Taroon)
> Kernel 2.4.21-4.EL on an i686
> login: ram
> Password:
> Last login: Thu Feb 17 14:00:45 from indl253ga
> You have new mail.
> [ram(a)indl253ga ram]$ ls -l /etc/passwd
> -rw-r--r-- 1 root root 2521 Dec 30 12:42 /etc/passwd
> [ram(a)indl253ga ram]$ exit
> Connection closed by foreign host.
> autoexpect done, file is script.exp
>
> -----------------------
> But if I run script.exp on command line again the
> ls -l doesnt execute
>
>
>
> [ram(a)indl253ga ram]$ ./script.exp
> spawn telnet ram
> Trying 152.69.188.253...
> Connected to indl253ga.idc.oracle.com (152.69.188.253).
> Escape character is '^]'.
> Red Hat Enterprise Linux AS release 3 (Taroon)
> Kernel 2.4.21-4.EL on an i686
> login: ram
> Password:
> Last login: Thu Feb 17 14:01:16 from indl253ga
> You have new mail.
> [ram(a)indl253ga ram]$
>
> --------------------- Just Hangs here Until I ^C and expect terminates
>
>
>
> This is my environment
> I am using a compiled version of expect 5.4.2 on redhat AS 3
>

can you post what script.exp contains?

Bruce


From: Don Libes on
claird(a)lairds.us (Cameron Laird) writes:

> In article <UUYQd.5$B47.63(a)news.oracle.com>,
> Ramprasad A Padmanabhan <ramprasad.padmanabhan(a)oracle.com> wrote:
> >Hi all,
> >
> > I am sorry if this is OT. I am recording a telnet session in
> >autoexpect , but any commands executed on the remote machine are not
> >recorded.
> >
> >For eg
> >
> >[ram(a)indl253ga ram]$ autoexpect telnet ram
> >autoexpect started, file is script.exp
> >Trying 152.69.188.253...
> >Connected to indl253ga.idc.oracle.com (152.69.188.253).
> >Escape character is '^]'.
> >Red Hat Enterprise Linux AS release 3 (Taroon)
> >Kernel 2.4.21-4.EL on an i686
> >login: ram
> >Password:
> >Last login: Thu Feb 17 14:00:45 from indl253ga
> >You have new mail.
> >[ram(a)indl253ga ram]$ ls -l /etc/passwd
> >-rw-r--r-- 1 root root 2521 Dec 30 12:42 /etc/passwd
> >[ram(a)indl253ga ram]$ exit
> >Connection closed by foreign host.
> >autoexpect done, file is script.exp
> >
> >-----------------------
> >But if I run script.exp on command line again the
> >ls -l doesnt execute
> >
> >
> >
> >[ram(a)indl253ga ram]$ ./script.exp
> >spawn telnet ram
> >Trying 152.69.188.253...
> >Connected to indl253ga.idc.oracle.com (152.69.188.253).
> >Escape character is '^]'.
> >Red Hat Enterprise Linux AS release 3 (Taroon)
> >Kernel 2.4.21-4.EL on an i686
> >login: ram
> >Password:
> >Last login: Thu Feb 17 14:01:16 from indl253ga
> >You have new mail.
> >[ram(a)indl253ga ram]$
> >
> >--------------------- Just Hangs here Until I ^C and expect terminates
> >
> >
> >
> >This is my environment
> >I am using a compiled version of expect 5.4.2 on redhat AS 3
> .
> .
> .
> Verrrrrrrry strange. You're doing exactly the right things;
> I sure don't see the problem. In particular, I have no reason
> to suspect timing problems, as you're already through to the
> command line on indl253ga.

Just because we see the command line doesn't mean the script found the
pattern it's looking for. The script is continuing to look for the
original "Last login" line.

Either edit out that part of the pattern from the script or rerun
autoexpect with the -p flag. That tells it to ignore everything but
the last line (i.e., the prompts) when generating patterns.

Don
From: Ramprasad A Padmanabhan on
>
>
> Just because we see the command line doesn't mean the script found the
> pattern it's looking for. The script is continuing to look for the
> original "Last login" line.
>
> Either edit out that part of the pattern from the script or rerun
> autoexpect with the -p flag. That tells it to ignore everything but
> the last line (i.e., the prompts) when generating patterns.
>
> Don


You were right, Expect was looking for the Last Login line which changed
, I created .hushlogin and recorded again works fine now.

Is there any good online resource ( free :-) ) which I can use for
learning expect. It is irritating , when I do a google search for
expect documentation , I get all type of documentations that have the
word expect in them.


Thanks
Ram