how to start a program using autoexpect
Kevin O'Gorman
kogorman at gmail.com
Mon Jul 9 13:24:16 UTC 2012
On Mon, Jul 9, 2012 at 6:18 AM, Kevin O'Gorman <kogorman at gmail.com> wrote:
> On Mon, Jul 9, 2012 at 3:51 AM, user1 <bqz69 at telia.com> wrote:
>> I am using 12.04
>>
>> I have installed: expect and expect-dev
>>
>> Autoexpect is in expect-dev package
>>
>> When I try to use autoexpect to start firefox I get:
>>
>> warning: The global `on()` function in content scripts is deprecated in
>> favor of the `self.on()` function, which works the same. Replace calls to
>> `on()` with calls to `self.on()`
>>
>> I can run commands like date and ls using autoexpect without problems.
>>
>> Example on how I use use autoexpect:
>>
>> $ autoexpect -c (To start autoexpect session)
>>
>> $ date (command I want to be run)
>>
>> $ exit (or Ctrl+d) - When done autoexpect session
>>
>> $ ^C (or close bash konsole) - To 'remove' autoexpect session
>>
>> To run the session:
>>
>> $ ./script.exp (sitting in /home/myusername/
>>
>> Anybody know how to start a program using autoexpect?
>
> Your question is unclear. You just started the program /bin/date in
> the snippet in your email. What more do you want?
If you have a command-line program, you can start it directly by
putting it on the command-line
autoexpect -c /bin/date
but unless it takes commands, I cannot see the point of using Expect at all.
Example using an old old game:
kevin at treat CWumpus $ autoexpect ./wumpus
autoexpect started, file is script.exp
INSTRUCTIONS (Y-N): n
ATTENTION ALL WUMPUS LOVERS!!!
THERE ARE NOW TWO ADDITIONS TO THE WUMPUS FAMILY
OF PROGRAMS.
WUMP2: SOME DIFFERENT CAVE ARRANGEMENTS
WUMP3: DIFFERENT HAZARDS
HUNT THE WUMPUS
YOU ARE IN ROOM 6
TUNNELS LEAD TO 5 7 15
SHOOT OR MOVE (S-M): m
WHERE TO: 5
YOU ARE IN ROOM 5
TUNNELS LEAD TO 1 4 6
SHOOT OR MOVE (S-M): ^Cautoexpect done, file is script.exp
kevin at treat CWumpus $
--
Kevin O'Gorman, PhD
More information about the ubuntu-users
mailing list