Questions tagged [expect]
80 questions
0
votes
1 answer
screen, expect and scripted detached interaction
Trying to write a bash script which will open a screen, start a python application, and interact with the python interaction as required when it is first started.
If not possible in screen, I would be happy to switch to tmux as an alternative. I am…

johnnygear
- 83
- 1
- 2
- 8
0
votes
2 answers
What could block the output of a command?
Sometimes I'll attempt a (2>&1) redirection and some/all of the resulting output appears to be silenced.
e.g.
wget -O- http://localhost/test.txt 2>&1
I would expect to see a merge of contents of test.txt and the output of the transfer, but instead…

tudor -Reinstate Monica-
- 1,805
- 18
- 36
0
votes
1 answer
expect script + write "if" in expect script
please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine )
I want to verify if OS is linux
so if it true the expect check if prompt is "#" or ">"
and then run the "ls" command
but I get the error…

yael
- 2,433
- 5
- 31
- 43
0
votes
2 answers
expect + how to install expect on solaris
subject - install expect on solaris in order to write expect scripts
details from my machine:
uname -a
SunOS 5.10 Generic_139555-08 sun4v sparc SUNW,Netra-T5220
I installed Solaris machine ( Solaris 10 ) , and then I installed successfully the…

Eytan
- 611
- 6
- 13
- 27
0
votes
2 answers
Httpd + Expect Script Fail (no more ptys) if httpd is not run through cli
I have a CentOS virtual server through Vmware. The server runs an httpd daemon which serves an php page with a form. The users complete the form, and by clicking submit the php page calls an expect scripts. If i run the httpd throught the default…
0
votes
2 answers
Get unix 'top' command output from Expect script
All,
EDIT
I want to execute a unix statement in Expect script and get an output without having to include the interact statement.The unix statement outputs rsize value for a process. I haven't programmed in Expect before.
This is my code:
…

smokinguns
- 103
- 1
- 3
0
votes
3 answers
Can I use expect with SCP to bypass the password prompt?
I am trying to transfer some files using SCP in a shell script, but I am being prompted for my password on the remote machine.
Can I use expect with scp to enter the password so I don't have to type it in all the time?

Mohammad AL-Rawabdeh
- 1,612
- 12
- 33
- 54
0
votes
2 answers
Build of expect v5.43 fails with Tcl v8.5.8
I'm trying to build "expect" from source v5.43, using Tcl built from source v8.5.8 on Redhat Linux. Tcl built fine, but my attempt to build expect fails. I run configure, then make, which gives me the error: `TCL_REG_BOSONLY' undeclared when…

E Brown
- 121
- 1
- 1
- 5
0
votes
1 answer
expect usage in bash script or bash command in expect script
I have a script below that works except for the expect portion:
#!/bin/bash
#
invdir=/home/john/inventory
for file in $invdir/$1
do
if [ -z $1 ] || [ -z $2 ]
then
echo "You must enter a value: prod, dev, dr, or test AND the password of the…

JKC
- 31
- 2
0
votes
1 answer
Script Need to send mail if condition dont match
looking for your advise.. i have expect script which execute perfectly and save output to a file, filename is 'fileout'.. output from fileout shows like below..
NAME STATE …

anukalps
- 1
0
votes
1 answer
Continue statement doesn't work as it should - bash
For the context, i have an infrastructure of multiple machines using ssh.
We connect via ssh as root on the machines without password thank's to the authorized_keys file on each mchine. We are adding regularly new machines in our infrastructure.
The…

AmelieAudet
- 13
- 4
0
votes
1 answer
Restart services on multiple remote servers securely
I need to write a script so that my colleagues and myself can restart different services on multiple servers. We all connect to the servers with LDAP so i'd like my script to connect our LDAP users to the server and then use sudo to restart the…

Ror
- 321
- 3
- 16
0
votes
0 answers
ansible.builtin.expect to automate an installation and having to go thru a license agreement
I am trying to use ansible.builtin.expect to automate an installer. At the beginning of the install, I have to "read" thru the license agreement by hitting the space bar 7 or 8 times. I do not know how to either specify text to expect, since it is a…

Mike
- 41
- 2
- 8
0
votes
0 answers
on expect: need to spawn a python script that fetches a string and send it back
The first script is basically an external lib that I don't want to tamper with.
I already tried the following:
set timeout 100
spawn python long-running-script-with-prompt.py
expect "Type the 6 digit code here:" {
set CODE [python…

Julian Dm
- 101
- 1
0
votes
0 answers
Bash to expect script to add user
Need help Required to convert below bash script in expect script.
#Script to Add User
tail /etc/passwd | cut -d: -f1
read -p 'Please Enter The Username To Add: ' name
echo "$name" > /tmp/userlist.txt
clear
echo -e "Hallo $name\nYour Name Is Added…

GauravG
- 19
- 7