Questions tagged [expect]
Expect is a Unix/Linux extension for the Tcl scripting language. It was designed as an automation and testing tool and it makes it trivial to interact with complex programs, such as remote shells, security maintenance. It has particularly powerful response recognition.
316 questions
4
votes
3
answers
509
views
Shell (.exp) script only sending 1 of 2 files
I have a bash shell script that runs via cron. The script looks for 1 of 6 possible (data) files in a directory. If 1 or more of these files is found, a new (control) file is created for each data ...
3
votes
2
answers
133
views
How might I make this expect script consistently work as expected?
I use an interactive wallet spectre-cli of Spectre, a coin similar to
Kaspa in its design.
When I manually want to get the balance of my wallet I need to run
spectre-cli and then connect, open
from ...
0
votes
3
answers
120
views
Expect script with Xargs and multiple parameters
I have an expect script that will SSH into a list of routers.
The expect script works on a list of routers in a file and is called from a bash script with xargs.
Bash : script get-rtr.sh
#!/bin/bash
/...
0
votes
0
answers
103
views
Expect Script TCL ending early
I have the following expect script which works for the most part. I have it connecting to a Cisco switch (eventually a couple hundred) and configuring syslog servers. It checks to make sure that ...
0
votes
1
answer
118
views
expect - repeatably send "\n\r" before a match expect
I need to netcat a U-Boot and perform NAND script and I use below script
spawn netcat -lup 6666
expect "Hit any key to stop autoboot"
#autoboot counts down from 3 to 0 and somehow one or ...
0
votes
1
answer
48
views
Looking for assistance in expect
I have a bash script that has expect to login to a remote host and run list of commands. It works as expected. It has a flaw, if the user enters the wrong password, the expect script keeps trying the ...
1
vote
1
answer
44
views
Automate passing JBOSS installer arguments using Expect Command
I have a JBOSS Installer which when run manually it will prompt for input and below is the sample of the execution is as below
[sp@sp baseInstaller]$ ./advStart.sh config
Buildfile: /home/sp/jboss/sp/...
0
votes
1
answer
463
views
expect script sending password before prompt
I have written a small expect script for automatic ssh to remote server. But sometimes my expect script don't work. Actually it sends password before password prompt. Here is my script
#!/usr/bin/...
0
votes
1
answer
602
views
Correct way to set PS1 prompt over ssh
I am trying to set the PS1 prompt dynamically on the my remote machine. The idea is that when I will do ssh to the remote machine, I will also send the value which will set as a prompt for that remote ...
0
votes
1
answer
191
views
Expect stuck after issuing exit command from application
Normally when in interactive mode, when I type in exit, it displays Disconnected from Virtual Machine 'pick0:LINUX' and then returns to the bash shell prompt.
With my expect script, it is stuck on ...
20
votes
1
answer
2k
views
Why does unbuffer -p mangle its input?
$ seq 10 | unbuffer -p od -vtc
0000000 1 \n 2 \n 3 \n 4 \n 5 \n 6 \n 7 \n 8 \n
Where did 9 and 10 go?
$ printf '\r' | unbuffer -p od -An -w1 -vtc
\n
Why was \r changed to \...
0
votes
1
answer
599
views
Expect: print a multi-line string all at once using echo
I have the following section in my code expect code:
set command "echo $output"
spawn bash
expect "$ "
send "$command\r"
expect "$command\r\n"
Where output ...
3
votes
0
answers
150
views
Waiting until an application is reading (over a TTY)
I'm writing an expect-style program to interact with a command-line application on Linux. Is there any way that my program can know when the application on the other side of the PTY tries to perform a ...
0
votes
0
answers
605
views
expect script terminating early in Dockerfile
I've got an expect script that I need to run in a Dockerfile. However, the script is terminating after all of the input is sent. What's interesting is that docker build is succeeding. Here's my MRE:...
1
vote
0
answers
285
views
How do you shut down an expect script in the presence of a complex shell interface?
I am running zsh inside of tmux with prezto, and a basic expect script is exiting improperly:
set timeout -1
spawn $env(SHELL)
expect -regex ".*"
send "echo 'foo'\r"
expect -regex ...