expect

Timeout doesn't work with '-re' flag in expect script

I'm trying to get an expect script to work, and when I use the -re flag (to invoke regular expression parsing), the 'timeout' keyword seems to no longer work. When the following script is run, I get the message 'timed out at step 1', then 'starting step 2' and then it times out but does NOT print the 'timed out at step 2' I just get a ne...

Problem with an expect script

Hi, I'm trying to create a script to update a password in a non-interactive way. It's working on my laptop but fails on my server. Both are running the same configuration, using Etch. This is the script: #!/usr/bin/expect -f # Change user passwd set timeout 30 strace 4 set password [lindex $argv 1] set old_password [lindex $argv 2] s...

How can I call an executable to run on a separate machine within a program on my own machine (win xp)?

My objective is to write a program which will call another executable on a separate computer(all with win xp) with parameters determined at run-time, then repeat for several more computers, and then collect the results. In short, I'm working on a grid-computing project. The algorithm itself being used is already coded in FORTRAN, but w...

Using expect to pass a password to ssh

How can I use expect to send a password to an ssh connection. say the password was p@ssword and the ssh command was ssh [email protected] What would I do with expect to a make it input the password when it says [email protected]'s password: ? The proper action of using an SSH key pair isn't an option because I would have to use ssh (scp) to pu...

Getting Expect to interact until the program terminates

I am using the linux too Expect and I have to interact with the shell. However, it's not a true interact, I just want to see what's going on. How can I get Expect to exit after the interacting program exits? ...

Ruby - Problems with Expect and Pty

I'm trying to write a Ruby script that will ssh over to a server, run a given command, and fetch the output from it. Here's what I've got so far, mostly adapted from the Programming Ruby book: require 'pty' require 'expect' $expect_verbose = true PTY.spawn("ssh [email protected]") do |reader, writer, pid| reader.expect(/[email protected]'s password:.*...

What is the difference between spawn and exec?

I'm learning to write a TCL (expect) scripts and I notice that some examples show to use spawn, while others show the command exec. I tried googling, but can't find what is the difference? Suppose I call 'exec' in a middle of a long expect script, what can I expect to happen? ...

How to rename/move all files with a certain extension?

I'm learning tcl (expect) and now I came to an interesting issue. I need a command to move/rename a bunch of files with extension .status. I tried these: spawn /bin/mv *.status some_dir exec /bin/mv *.status some_dir Of course, that did not work. I googled a bit and found something about glob, but it doesn't seem to work the way I wan...

How can I encrypt or hide passwords in a Perl script?

I am working on Perl script that uses Expect to login via telnet to remote machines (don't ask, gotta use telnet). I also do perforce p4 login operations as necessary and use expect to pipe in the correct passwords. For now I just read passwords from clear text environment variable, i.e. export PASSWORD=password, which I know is no good ...

Is there autoexpect for Perl's Expect?

I would like to generate Perl Expect code automatically, does something like autoexpect exist for Perl's Expect?? ...

Is there an equivalent of Don Libes's *expect* tool for scripting interaction with web pages?

In the bad old days of interactive console applications, Don Libes created a tool called Expect, which enabled you to write Tcl scripts that interacted with these applications, much as a user would. Expect had two tremendous benefits: It was possible to script interactions that otherwise would have had to be repeated by hand, tediousl...

Using expect to login into SVN

I am trying to use an automated script, which would login to SVN, update my sources, create a tarball with these and scp them to a remote host. The problem here is that, for every login to SVN (even for checkout or update), we require to enter our password. Automation of password entry, the only way that I could find, was using expect t...

How can I make an expect script prompt for a password?

I have an expect script that connects to a few routers through ssh. All these routers have the same password (I know, it's wrong), and the script needs to know that password in order to be able to connect to the routers. Currently, the password is passed to my script as an argument on the command line, but this means that there's a tra...

Expect addition

I have been playing around in expect recently and I for the life of me can't figure out how to perform a simple addition on a variable I passed in. Anyone know how to do this? Also, is there a decent online reference for Expect? I have tried googling with very limited results. ...

Don't make me manually abort a LaTeX compile when there's an error.

As suggested here, latexmk is a handy way to continually compile your document whenever the source changes. But often when you're working on a document you'll end up with errors and then latex will panic and wait for user input before continuing. That can get very annoying, especially recently when I hacked up something to compile late...

What are the advantages of rsh versus Perl's Expect.pm?

I have a Perl Expect.pm script that does some moderately complex stuff like packaging applications, deploying the application, checking for logs, etc. on multiple remote unix hosts. My predecessor had written similar scripts using rsh. Is there a better approach between the two? Or should I use something all together different? I am...

Why does string match fails in this "expect" code?

I have created the following procedure in expect to work with an Agilent Base Station Simulator: proc get_bss_parameter_value {bss parameter_string} { global bss_array set bss_str "$parameter_string?" puts "String 1" set bss_str "oa;$bss_array(gpib):$bss_str\r" send "$bss_str" expect {nopattern^} puts "String 2" set bss_str "en;$bss_...

Enter password multiple times

I am running an application, which prompts for a password of the user about a dozen times :-( I tried using expect to circumvent this issue, and make it run in auto mode, but am unable to get over the issue of the multiple times password, which is not exactly static. Sometimes it asks 4-5 times and sometime around 9-10 times. Is there a...

How to use an expect script from php webpage ?

Hello, When i try to execute a program from php5 on my debian, the webpage freeze and the program do nothing. This script works when i call it from the command line. Safe mode is disabled. Echo stdout doesnt work (because of the freeze). I read some answers in google which tells of www permissions but if someone here have a quick and si...

can I use expect on windows without installing cygwin?

expect is a module used for spawning child applications and controlling them. I'm interested in python/ruby. ...