expect is a tool for automating interactive applications according to a script.
Questions tagged [expect]
42 questions
14
votes
2 answers
How to write a script that does collectstatic for django
I want to do an automatic collectstatic script for my django application. I tried various things but it did not work. My last attempt is to call an expect script within a normal script:
collectstatic.sh:
python manage.py collectstatic…
14
votes
2 answers
Unbuffer stopped working months ago
I find the "unbuffer" command very important and useful, because I am running python code, and I don't think I can just put something equivalent to fflush() everywhere.
I used to use it just fine: unbuffer python foo.py | tee filename.log
A few…
Starman
- 298
8
votes
2 answers
Can't find package Expect while executing "package require Expect"
I want to use autoexpect for a simple .sh file but the terminal shows this error:
can't find package Expect
while executing
"package require Expect"
(file "/usr/bin/autoexpect" line 6)
my terminal command is:
autoexpect shell.sh
I remove…
Milad
- 193
6
votes
1 answer
Why so many dependencies for package expect?
I hope someone smarter than me can help me out with this one. It appears I've got something messed up in my apt database(s).
I'm running Ubuntu 16.04.2 LTS. I've downloaded ossec-hids_2.8.3-4xenial_amd64.deb from ossec.wazuh.com, and when I try to…
user352726
- 153
5
votes
2 answers
Bash script for 'apt-get update' with automatically insert password
I want make shell script to start sudo apt-get update, automatically insert password for sudo and automatically hit enter key.
I've tried:
#!/bin/bash
sudo apt-get update
expect "[sudo] password for username: "
send "password"
Edward
- 63
3
votes
1 answer
How we can copy one file from one server to other in cron
Can anybody let me know how we can copy a file from one server to another in a cron. I know about scp but how we use it in a cron, since we need to pass the password.
Edited
I found this link Expect script that enters a username and password
Can…
Pramod
- 251
3
votes
2 answers
Modifying bluetoothctl automation script - How to remove output from expect & spawn?
I'm trying to automate the pairing of my headset to my ubuntu16 machine.
I took this nice script and tried it, but it didn't work. I played around a bit, and found out that I can just work with this minimal script:
#!/usr/bin/expect -f
set prompt…
CIsForCookies
- 1,129
2
votes
1 answer
Automating SSH login gives unresponsive remote-shell, dropping back to client-terminal (without errors)
I have a problem with the tool expect under Ubuntu 14.04 LTS. I want to automate ssh logins to some Sophos UTM Firewalls and evelate my rights directly after with "sudo su -" and the correct password. I don't have to worry about plain text…
Nyctophilia
- 21
- 2
2
votes
1 answer
Expect script changing send of "\\" to just "\"
So I am attempting to use expect to automate backing up the running config of some switches on our network. The problem that I'm running into is its changing a part of my send commands and I dont know how to fix it.
For example I'm using whats…
GTerry
- 23
2
votes
2 answers
Using bash commands in expect script
I've tried using some bash commands in an expect script before spawning anything, and this doesn't seem to work:
#!/usr/bin/expect
sudo ifdown usb0
sudo ifup usb0
expect "[sudo] password for stud:"
send "FirstPassword\r"
spawn ssh…
Tachyon
- 21
2
votes
2 answers
Problem using expect variable!
I am trying to automate my vpn using a shell scipt
What I want is to get a webpage (curl) and parse it for password.
If I write a normal script looks something like:
var=$(curl -i http://www.vpnbook.com/freevpn | grep "Password: *")
echo…
xyz
- 1,836
2
votes
1 answer
expect interferes with character encoding during ssh
In my company we use expect to automate tasks, when ssh'ing into other systems. All our legacy systems run ISO-8859-1 character encoding, while our desktop systems run UTF-8 encoding. Which of course poses certain challenges when ssh'ing from one of…
Jens Bang
- 23
1
vote
1 answer
expect script to scp via an intermediate host
I found a command to directly scp my file to a host (C) via another host (B) from my computer. The command is in this form:
scp -oProxyCommand="ssh -W %h:%p B" thefile C:destination
I used it and it works good in command line. but when I want to…
1
vote
1 answer
Automate script on boot to connect via ssh
So I'm at my wits end with this, I'm not a complete n00b with Linux but I know enough to get around etc and change other peoples scripts.
Here's what I am trying to do. Firstly I wanted to enable passwordless ssh into my pi2 using public/private…
Sephzer
- 11
1
vote
1 answer
execute local bash script in remote machine using expect
I have local shell script. Now, I want to run this local script in remote machine. Of course I can use ssh, but as it(the local shell script) should be like an automated one, it shouldn't ask for password to enter manually. So I used expect to…
Uvais Ibrahim
- 294