Re: [Expect] Need to have explanations for the use of the expectcommand
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: [Expect] Need to have explanations for the use of the expectcommand

From: Andrew Falanga <not_real@hp.com>
Date: Wed Mar 15 2006 - 21:14:20 CET

>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> this the last line you get right?
>
> if you put an [ expect -re .*] at the end
> you will see the trace of succesful login ( or not)
>
> if you put an [interact] at this point in your script
> you will be able to interact with your test setup.
>
> what is your next step to accomplish now?

Well, to be honest, the command I'm trying to issue remotely will
restart some software on the remote box. That wasn't working so I went
to something more simple (thus the "cd logs; ls" command).

When I run the expect script, it seems to work (I guess). I did as you
suggest and put an expect .* at the end of the script and it certainly
doesn't timeout anylonger. However, I don't see the directory listing
(and yes there are files in that directory). When I execute that
command at the bash prompt I see the directory listing.

Also, when I issue the command to restart software, throug expect, I can
tell that the software isn't restarted. Am I wrapping the commands
being passed to ssh incorrectly? I'm wondering if, somehow, they should
be separate instead of inside quotes. The trouble is removing the
quotes makes expect (TCL) think that's the end of that comand sequence
and time to begin another.

Any ideas? Thanks everyone for the help thus far. I've never used
expect before this and am very much a neophyte.

Andy

>>
>>
>> I don't know what exp4 is, nor do I understand what expect_out is.
> exp4 is the spawn_id your ssh process "hangs" on
>
>
> uwe

-- 
---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled.  I do not wish my account at HP to
become a spam haven.
Received on Sun Apr 30 02:34:19 2006