Questions tagged [expect]

expect is a tool for automating interactive applications according to a script.

Filter by
Sorted by
Tagged with
0
votes
1answer
63 views

expect script not working in cron but runs successfully in terminal

Here is my expect script named as script.exp which runs successfully when executed from terminal. But it doesn't run when scheduling through cronjob. #!/usr/bin/expect -f set timeout -1 spawn ./...
0
votes
0answers
31 views

How to spawn an already run process in expect script

I've already run a process, for example "fdisk /dev/sda" with the PID of "2000" Now I execute expect script and I want expect to take control of stdin and stdout of my desired PID (...
4
votes
1answer
532 views

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&...
0
votes
1answer
81 views

autoexpect fails to run

I just installed the expect package (which is supposed to contain autoexpect). When I run autoexpect, I get this error: can't find package Expect while executing "package require Expect" ...
1
vote
0answers
35 views

Bash, using expect keyword

I have connected to a port like this: nc hello-world.mygame.com 2000 which opens a small game like this: Please enter your name a hello a, Now I know that a specific number of repeated "a" ...
2
votes
2answers
607 views

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 ...
0
votes
1answer
301 views

Package expect is not installed in gnome connectiom manager [duplicate]

I'm trying to install gnome connection manager after installation following process comes. sudo dpkg -i gnome-connection-manager_1.2.0_all.deb Selecting previously unselected package gnome-connection-...
0
votes
2answers
1k views

automatically entering passphrase in openssl command

I'm writing a script that automatically enters the user's input for an openssl command, but I can't find a way of entering the required passphrase automatically by the script. What I've tried: spawn ...
0
votes
0answers
325 views

Catching the output from service which hangs in expect script

I am writing expect script to run bluetoothctl commands. When the commands run successfully when bluetoothctl runs well. But if there is problem with bluetooth service it shows "Waiting to connect to ...
1
vote
2answers
6k views

Automate the mysql secure installation using shell script

I am trying to automate mysql secure installation using linux shell scriping. I have below code got from https://gist.github.com/Mins/4602864. #!/bin/bash MYSQL=$(grep 'temporary password' /var/...
1
vote
1answer
240 views

How can I auto-close an urxvt terminal after executing an expect script?

I've written a script to handle quick copying of passwords to the clipboard: #!/usr/bin/expect -f spawn -noecho zsh expect "$ " send "pass show -c " interact exit This script is launched like this: ...
2
votes
1answer
1k views

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 ...
11
votes
1answer
3k views

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: ...
0
votes
0answers
55 views

Issues with vi command over expect/spawn ssh session

I am running Xubuntu 16.04. I have an expect command to connect to a remote centos server using ssh. I did this to automate the authentication information which I used to manually enter earlier. After ...
1
vote
0answers
380 views

issue with expect to autofill login details

I am looking for help in filling the login details in terminal on ubuntu. I have a script test.sh which when run prompts for the following details in the terminal Enter Auth Username: username Enter ...
0
votes
1answer
1k views

Expect extra characters after close-quote

I'm getting an error extra characters after close-quote while executing "spawn ssh-add <(echo -e "-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,...
1
vote
1answer
2k views

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 ...
6
votes
1answer
5k views

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-...
3
votes
2answers
3k views

Bash script for 'apt-get update' with automatically insert password [duplicate]

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 ...
-1
votes
1answer
1k views

using awk inside expect program

I'm using the command below to merge file1 and file2 to get file3: awk 'NR==FNR {a[$2]=$1; next} {$(NF+1) = a[$NF]} 1' file2 file1 > file3 When I use this command inside bash script using expect ...
1
vote
1answer
756 views

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 ...
0
votes
1answer
736 views

Expect script help

I need some help with he expect command. I am trying to unpack the teamspeak 3 Linux client automatically. Here is my script to grab the file #!/bin/sh mkdir /home/test && cd /home/test ...
2
votes
1answer
615 views

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. ...
2
votes
1answer
680 views

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 ...
0
votes
2answers
6k views

Save terminal output to variable in expect/tcl

Hej all, I have to use an interactive program and I want to automatize it with expect. My experiences in Linux and scripting is not the best. So this is the program output: enter minimum cross-...
13
votes
2answers
6k views

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: ...
0
votes
1answer
7k views

How to do more with an expect script than just a log in

I have an expect script that logs into my Beaglebone: #!/usr/bin/expect -f spawn ssh debian@192.168.7.2 expect "debian@192.168.7.2's password:" send "temppwd\r" interact &&...
2
votes
1answer
18k views

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:" ...
0
votes
2answers
4k views

Get notified about new files on SFTP server

I am looking for any solution for my problem. I have SFTP access to client's server and I need some script or something else to watch after new files because they are added irregularly. I need this ...
0
votes
1answer
985 views

Unable to execute expect script via cron even with the permissions set to 777

I created an expect script that won't seem to run when called by cron. I included the full path in cron when calling it as follows. * * * * * /usr/local/sbin/checkForRemoteTasks >/...
3
votes
1answer
2k views

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 ...
1
vote
1answer
4k views

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 ...
0
votes
2answers
8k views

How can I use " inside send command

I have used the /usr/bin/expect interpreter to telnet into my other system and execute some commands using send. Telnet is successful however the problem is that I have to use the following command ...
1
vote
1answer
224 views

bfgminer not catching xdotool

I'm trying to send a short sequence of keystrokes to bfgminer without bringing its window to focus, it is running in a gnome-terminal. #! /bin/bash xdotool key --window 25165831 p sleep 1 xdotool key ...
0
votes
1answer
2k views

How to get response from ssh command using expect

currently I am using following code, #!/usr/bin/expect -- set timeout 60 set username [lindex $argv 0] set password [lindex $argv 1] set ip [lindex $argv 2] spawn ssh $username@$ip expect { ...
2
votes
2answers
3k views

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....
1
vote
1answer
4k views

Can't run a .sh file even when changing directory

I want to know how to excute a .sh file. I have tried to change the directory as (Wi-fEye-v0.5.6/bin$) and run ./filename.sh but it said: bash: ./evilgrade.sh: /usr/bin/expect: bad interpreter: No ...