Skip to main content

Questions tagged [expect]

Expect is a utility based on TCL. It's primary use is for building automation into interactive environments such as telnet or ssh based terminal environments. It provides the ability to enter commands on a command line and interpret the output.

14 votes
1 answer
121k views

What is the meaning of the "spawn" command in Linux (Centos6)

I need to know how to set up a cron job that automatically connects to a remote server, then changes to a directory and downloads all the files in that directory to local. I think I have to use SFTP ...
user1179459's user avatar
7 votes
1 answer
1k views

Can Expect make sure a certain log does not appear?

Expect scripting is great for writing tests that are basically "make sure that running this command causes these logs to be printed". Expect lets you skip past the irrelevant output and look ...
Woodrow Barlow's user avatar
6 votes
1 answer
8k views

Which characters require escaping in expect strings?

I know that hard brackets [, ] require triple backslash escaping when used inside expect "..." strings, so I use expect "blah blah \\\[herp derp\\\]" to accurately convey these characters to the ...
mcandre's user avatar
  • 3,058
5 votes
3 answers
11k views

How to by-pass user interactions in a script?

I am trying to automate the installation of a program through a shell script. There are a few steps which require user interaction from the command line (confirmation, yes/no, etc.). What is the best ...
Vignesh's user avatar
  • 53
4 votes
3 answers
8k views

Automating an ssh connection with crontab

I've been struggling to crontab automate a git push process with ssh, and it's proving tricky to setup a key with the ssh agent. Starting with a basic script to test the agent: # set paths (all ...
geotheory's user avatar
  • 1,089
2 votes
1 answer
17k views

expect + how to verify if dir exists and if not how to create it

I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory /var/cti/adm/APP exists If APP not exists under adm ...
maihabunash's user avatar
2 votes
2 answers
12k views

couldn't execute "mysql": no such file or directory, using autoexpect

I have the following file: exp.exp #!/usr/bin/expect db_host='localhost' db_name='webui_dev' db_user='root' db_pass='rootpass' new_db_name='db_2011' expect <<EOF log_user 0 spawn mysql -h ...
Andrey Yasinishyn's user avatar
2 votes
1 answer
5k views

expect -timeout vs. "set timeout" in expect: Different behavior

I was testing a expect script and found two different behaviors when using set timeout vs. expect -timeout. Here is a simple example response.sh: #!/usr/bin/bash sleep 2 echo hello test1.sh: #!/usr/...
user3711775's user avatar
2 votes
2 answers
9k views

Installation of Expect on Windows 7 64-bit fails with "not found in the archives"

Downloaded ActiveTcl from http://www.activestate.com/activetcl/downloads/ Installed ActiveTcl at c:/Tcl/ Go to Bin directory in command prompt (Start > Run > cmd > cd c:\Tcl\bin) To install Expect, I ...
user avatar
2 votes
1 answer
2k views

How can I set up nautilus to use a ssh connection established by an expect script?

In order to automate a ssh connection, I wrote a script using expect, which works just fine. However, I would like to use this script in the nautilus connect to server function. My idea was to include ...
Daniel Förster's user avatar
2 votes
1 answer
7k views

expect command in ubuntu

I've searched all over SuperUser, but couldn't get the solution. Here is a script that am using for ssh using expect. I'm using ubuntu and I've installed expect using aptitude install expect. #!/usr/...
CodZilla's user avatar
2 votes
2 answers
2k views

Bash/expect script to log in via ssh and port knocking. SSH Keys not possible

My login server is behind a firewall that uses port knocking to allow entry. The login-flow is Enter in port knocking command. This requires my external IP to be entered. When prompted, enter in my ...
Zach Melnick's user avatar
1 vote
1 answer
2k views

Why doesn't redirect work for scp password input?

I want to copy from remote box with scp, while the fact that each time I have to re-enter password is annoying. So I store my password in plain text and expect the following code should work scp -...
Summer_More_More_Tea's user avatar
1 vote
1 answer
880 views

Unbuffer swallows the exit status of killed process

The expect "unbuffer" command seems to swallow the exit status of its child if the process is killed. Is there something that can be done to stop this behavior? It does not swallow the exit status if ...
frankc's user avatar
  • 301
1 vote
1 answer
3k views

How do I send the stdout of a command to an Expect input?

I want to write a shell + expect script that auto-fills my passwords via the LastPass CLI utility lpass. I'm not sure how to accomplish sending the password returned by lpass to the password input in ...
Josiah's user avatar
  • 113

15 30 50 per page
1
2 3 4 5