Expect: expect vs. interact

Expect: expect vs. interact

Post by Huy » Sun, 09 Jul 1995 04:00:00



Hey Don or any other expect person:

For comparable uses, which is faster, expect or interact, or is there
any difference?

By comparable, I mean:
    expect {
        -re .+ {
            send_user -raw -- $expect_out(buffer)
            exp_continue
        }
        -i $user_spawn_id -re .+ {
            send -- $expect_out(buffer)
            exp_continue
        }
    }

vs.

    interact

or (I know, slightly different semantics)

    expect {
        "crap" { exit }
        -re .+ {
            send_user -raw -- $expect_out(buffer)
            exp_continue
        }
        -i $user_spawn_id -re .+ {
            send -- $expect_out(buffer)
            exp_continue
        }
    }

vs.

    interact {
        "crap" { exit }
    }

--

http://www.ugcs.caltech.edu/~huyle

 
 
 

1. Expect, Spawn or Interact?

        Hello everyone.  Does anyone out there know about Expect, Spawn or
Interact?  If there is, can this person help me in a problem I'm
having with script files.  
        Here is my problem.  I have this program called zipcloak that encrypts
zip files.  The thing is that I want to make a script file that when I type
in this command :

                scriptfile password zipfile

it will encrypt the zipfile with the password.  Apparently this type of
interacting will not work with any of the shells (Bourne,Korn or C).
Someone suggested that I use expect.  I've been using the man pages on it
but can't really get my test program to work.

#!/crc/sun4/bin/expect -f   /* location of expect file */

spawn telnet telnet.site
expect {login:*}
send "login_name \r"
set timeout 15
expect {Password: *}
send "password \r"

This goes through it and then sends me back to where I was.  It doesn't go
into the account I was telnetting to.  So if anyone out there can give me
any suggestions about this, I would really appreciate the help.

Thanks in advanced.

Cuong Tran


2. Q: Using Ye with kernel 1.2.13

3. expect regex interact key

4. semi-embedded linux?

5. Expect/Tcl Problem - "scripts expect Tcl version..."

6. XFree86 Link Kit Problem

7. expect and expecting it this way or this way...?

8. Damaged system areas

9. How to compile EXPECT was WANTED expect for Linux

10. expect for AIX where can I find freeware.expect.rte

11. expect-send pairs and sub expect-send pairs in chat

12. Expect: How to expect clear screen

13. Kermit and expect problems with 2.0