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.

0 votes
0 answers
123 views

How to display output from expect?

I'm trying to read data from a machine that uses a telnet style interface using expect. An interactive telnet session works like this: % telnet 10.92.177.14 53595 Trying 10.92.177.14... Connected to ...
Elliott B's user avatar
  • 1,245
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
0 votes
1 answer
106 views

What's the best way to replay keystrokes on to my terminal?

I find myself having to do a series of ssh in order to get to a particular host. What I currently do is to copy and paste the commands into the terminal, one after the another, like a machine. I'm ...
Jeenu's user avatar
  • 266
0 votes
1 answer
331 views

expect spawn command: Escaping newline (\n) in string

I am trying to use expect to interact with the MATLAB console. Currently I have: #!/usr/bin/expect -f spawn {*}/usr/bin/run.sh matlab -r "fprintf(1, \"The identifier was:%s\\\\n\", \&...
user3711775'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
0 votes
1 answer
686 views

how to use expect into bash to automate installation

I have a bash that answers the questions that freefilesync asks during installation, using expect: #!/bin/bash tar -xf FreeFileSync*.tar.gz mv FreeFileSync*.run FreeFileSync.run >/dev/null 2>&...
acgbox's user avatar
  • 785
1 vote
1 answer
2k views

passing bash variables to expect script or scripting expect from inside bash

This script is intended to mount the contents of my server at home as a read/writeable drive in mac os. Unfortunately due to the fact that my house has a dynamic public ip address, the ip address of ...
Christian Maxwell's user avatar
0 votes
1 answer
990 views

Eternal loop with expect

I want this expect script to run forever (or until "ok" is printed), however it does not and exits right away. #!/usr/bin/expect set timeout 180 spawn ssh -o "StrictHostKeyChecking no&...
michelemarcon's user avatar
0 votes
2 answers
464 views

For cycle with expect and variable evaluation

I want to execute a script remotely with expect and a for loop: #!/usr/bin/expect set timeout 10 spawn ssh [email protected] expect "password: " send "pass\n" expect "$ " ...
michelemarcon's user avatar
0 votes
1 answer
5k views

Setting and using a variable within a single-line Expect command in a Bash script

I have an array, $HOSTS, which contains a set of hostnames. I have a database table that has a set of IP addresses. I want to go through each IP address in that table and send a command (hostname -s) ...
Kefka's user avatar
  • 1,446
0 votes
1 answer
2k views

Expect script - sometimes no log generated

I have a simple expect script that supplies password 4 times. I am logging the output to a log file using log_file -a /home/applusr/e291505/logs/ADD.log spawn /home/root/admin/add.mims.user $...
Uday's user avatar
  • 11
0 votes
0 answers
154 views

Is it possible to detach and re-attach to a spawned process using separate expect processes?

I have an expect script that spawns a process, then does some initialization (authentication), then performs some task that needs prior authentication. Considering to extend the script to execute ...
U. Windl's user avatar
  • 705
0 votes
1 answer
269 views

spawn, expect, send aborts during scp transmission

I have a basic scp sending mechanism with spawn, expect and send. However it gets aborted during the scp transmission. Here is the expect command: expect -c "spawn sh -c {scp -r -P 22 /tmp/rootfs/* ...
Daniel's user avatar
  • 577
1 vote
1 answer
7k views

How do I get my expect statement to not output the stdout of the first command?

What I'm trying to do is execute an ssh command that prints out the /etc/shadow file. Obviously that file requires root or sudo permission, and I don't have root creds, therefore I have to use sudo. ...
beechfuzz's user avatar
0 votes
0 answers
292 views

Bash automation SFTP script not moving the last file once in a while

I have developed a bash script for moving files to FTP only when a particular CSV is available in remote server. A job from another Data quality tool calls this script. Script is working fine, but it ...
Syam Sundar's user avatar

15 30 50 per page
1
2 3 4 5