All Questions
29
questions
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
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\", \&...
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
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
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
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 $...
0
votes
1
answer
271
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/* ...
0
votes
1
answer
65
views
Expect not exiting non-zero
My real goal is to have a script that will run locally to ssh into a remote server, restart tomcat, and use expect to wait for the "Server startup in" message, or exit non-zero if it sees startup ...
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 ...
0
votes
1
answer
2k
views
Does set timeout change each expect statement, or just the final expect eof?
I'm learning to use /usr/bin/expect for the first time, to automate the nightmare that is installing fink from source, as that script has a few dozen prompts, all of which can be answered with the ...
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
3k
views
Variable expansion and escaping in heredoc syntax
I've got the following script to scrape out the arp table of a switch. No matter how I try to escape everything, quote it or otherwise try I can't get it to work properly. The bash line is interpreted ...
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 ...