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.

1 vote
2 answers
14k views

Ansible expect not working for multiple prompt values

I need to install nginx agent for openam using ansible. while install the nginx_agent it asking multiple question while run the script, **********************************************************...
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) ...
0 votes
0 answers
139 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 ...
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 ...
0 votes
1 answer
107 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 ...
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 ...
0 votes
1 answer
336 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\", \&...
0 votes
1 answer
3k views

How to handle a condition when an expect script executing another script on a remote host is interrupted?

Im using an expect script to say xyz.exp to login to a remote host and execute another script abc.sh Now most of the times abc.sh runs fine, but there is a scenario where if a certain condition is ...
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/...
0 votes
1 answer
692 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>&...
0 votes
1 answer
1k views

How to toggle outlet power to Eaton ePDU G3 from shell script

I'm trying to programmatically toggle power to several outlets on a Eaton ePDU G3 using ssh via Jenkins CI shell script. This is to fire up lidars only during a Jenkins run. It is not clear how to do ...
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 ...
0 votes
1 answer
1k 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&...
0 votes
2 answers
472 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 "$ " ...
0 votes
0 answers
601 views

Obexctl: Provide different result in terminal and script

I have created a script where I want to send file over bluetooth. For that I took "obexctl" utility. I can transfer file using obexctl utility over terminal. But when I'm trying to incorporate the ...

15 30 50 per page
1
2 3 4 5