Skip to main content
The 2024 Developer Survey results are live! See the results

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.

0 votes
1 answer
32 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 ...
thomasyang's user avatar
0 votes
1 answer
35 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 ...
Vraja's user avatar
  • 1
1 vote
1 answer
22 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/...
sabarish jackson's user avatar
0 votes
1 answer
220 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/...
sachu's user avatar
  • 3
0 votes
1 answer
229 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 ...
sachu's user avatar
  • 3
0 votes
1 answer
84 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 ...
supmethods's user avatar
18 votes
1 answer
1k 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 \...
Stéphane Chazelas's user avatar
0 votes
1 answer
299 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 ...
shintuku's user avatar
  • 143
2 votes
0 answers
85 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 ...
Subhav's user avatar
  • 21
0 votes
0 answers
390 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:...
Daniel Walker's user avatar
1 vote
0 answers
205 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 ...
Chris's user avatar
  • 983
0 votes
1 answer
161 views

How can I use regex to match the contents by using expect?

I am new to expect for using the regular expression. trying to parse below input stream. How it can be parse with regexp. As CNTXID is incremental. "Data" CNTXID = 1 ...
user558421's user avatar
0 votes
1 answer
1k views

adding ansible_python_interpreter to task with expect module fails to get command with become_user

I'm writing a task for CentOS7 inventory in which have to go through prompt dialogues, which I think is best candidate for andible's expect module. - name: setup some command become: yes ...
Sollosa's user avatar
  • 1,951
1 vote
0 answers
200 views

Running expect in systemd unit causes sh syntax error

I am trying to automate the process of connecting to my VPN (SonicWall NetExtender) from my Linux machine by using a systemd unit to call an expect script that supplies the login credentials to the ...
MrDrMcCoy's user avatar
  • 121
1 vote
1 answer
3k views

Creating a branch in expect, using an IF statement

I am writing an expect script to deal with a plethora of prompts. The bash script that I am working with can follow one of two sequences: prompt1 -> prompt2 -> prompt3 prompt1 -> prompt3 ...
VBtheHun's user avatar

15 30 50 per page
1
2 3 4 5
21