The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
47 views

Multiplex bash function execution

I created a bash function to "automagically" connect on our switches and retrive their startup-config using the expect command. I have to use expect because this switch does not accept the ssh ...
0
votes
1answer
193 views

Is expect tool availabe for ARM platform

I need to get expect (tool for automating interactive applications) for the ARM platform. Is it a readily cross compiled to ARM and is it available? I tried googling but was unable to get the ...
0
votes
1answer
230 views

“Expect” automation tool output to shell variable

#!/bin/bash # more commands here expect << EOD spawn telnet localhost 9151 expect -exact "Trying 127.0.0.1...\r Connected to localhost.\r Escape character is '^]'.\r" send -- "AUTHENTICATE ...
2
votes
2answers
346 views

Regular expressions with ExpectJ

I've been used the ExpectJ Java library to automate some jobs on a Linux server, however now I need to automate a job that sends a different text response for each execution. Here is the output: Last ...
2
votes
2answers
2k views

grep output of expect script

I'm trying to run some expect language, and grep/parse the output all in one script. I want to grep the output of and look for "error" (I should note that standard linux commands like awk, sed, grep, ...
2
votes
2answers
3k views

Cross compiling expect for ARM

I have downloaded expect5.4 . I'm trying to cross compile it for ARM(PandaBoard) running stripped down version of linux. In the initial setup of configuring , I try Shell$ ./configure --host=ARM ...
1
vote
1answer
91 views

grep ipaddress in expect script

this is part of code, expect script and I have problem with greping ipaddress from file wich is assign to variable $filename.This is the code: #!/usr/local/bin/expect -- ###Made by Etihkru#### ...
4
votes
3answers
2k views

bash script error stty: standard input: Inappropriate ioctl for device

I'm using here-documents in a bash script to automate installation and setup where a password is required many times. I enter the password once and the script passes it to the various commands. In ...
1
vote
1answer
1k views

Bash script calls expect script with master SSH connection

I'm trying to write a bash script that calls an expect script to establish a master SSH connection to be used for the remaining SSH commands in the bash script. ~/.ssh/config: ControlMaster auto ...
1
vote
2answers
169 views

Help me understand this echo/spawn/send/expect construct

Here is a line from a bash script I am trying to understand: echo "spawn myscript.sh arg1 arg2; expect \"Please enter your value: \"; send \"myval\r\"; expect eof" | expect I think I understand the ...
0
votes
2answers
1k views

Expect script within bash & exit codes

I have a bash script that calls an expect script. The expect script has several conditions. It ssh's into a box and executes a command, and there are different possible errors that could happen which ...
1
vote
2answers
368 views

PHP exec expect script with SCP then SSH

I have a PHP page which runs the following expect script to upload a file to another server on my network: #!/usr/bin/expect -f set password [lindex $argv 0] spawn /usr/bin/scp /home/Dave/bin/test ...
6
votes
2answers
218 views

Removing non printable characters from expect logs?

How can I either strip the following character sequences from my files? ^[[64;8H, ^[[?25h, ^[[1;64r etc or avoid having expect add them in the first place? Background: I'm using a collection of ...
3
votes
2answers
1k views

Using expect to send Ctrl+D to a telnet connection

I want to use expect file for connecting to telnet session automatically, the flow is: when we connect to some IP & port, it will show escape character is ] after that we have to give Ctrl+D I ...
3
votes
1answer
143 views

How to use `expect` with `zipcloak` II?

This question is a followup on this question, as I figured out the solution I presented in the previous question does not work anymore. It worked sometime, but now expect does not work as expected. ...
1
vote
1answer
158 views

script to automate scp in network

I have a network full of Linux machines. In this network, I have a user as user1 with the password as password in all the machines. I have the following script to put files in the home directory of ...
2
votes
2answers
85 views

How to use `expect` with `zipcloak`?

I create a zip file using zip which includes several files and directories, named test.upd. Now I want to use expect to automatically handle the password encryption. Here are two bash scripts, both do ...
3
votes
1answer
216 views

Why is expect's interact command not working?

I am trying to automate gdb with expect. My script will start gdb, do some initialisation, and then pass the control to the user. Expect's interact command seems like the perfect tool for the job. ...
0
votes
3answers
288 views

Script to login to ssh twice

I need to login through ssh twice with a script and can't get it to work. This is what I have in my script file: #!/usr/bin/expect set login "user" set addr "address1" set addr2 "address2" set pw ...
3
votes
1answer
508 views

sudo askpass: ask from other tty

Context I want to setup rsync backups of my server, so I run the following command rsync -r -e ssh --rsync-path="sudo rsync" rsyncuser@example.com:/ /backup/ Ideally, that command would ask my ...
1
vote
2answers
295 views

how to escape unusual/uniq characters from expect scripts?

in expect script I can set any command or character to run it on remote machine but the sad thing is that expect cant send the same character as they defined in the expect script for example I want ...
2
votes
1answer
165 views

how to replace IP address on remote host using expect

I wrote the following expect script in order to replace the IP address on remote Linux machine I use a perl one-liner for this task I get errors about can't read "HOME": no such variable , Please ...
3
votes
3answers
143 views

How to send part of the data through the pipe/file and later interactively?

I have a command I want to run, let's call it program. It is an interactive program similar to bash or python REPL. I want to start this program with some predefined input. I tried program << ...
2
votes
2answers
484 views

How to automate connecting to multiple network devices, running a command and saving the output to a file?

I have to run a command on around 1000 network devices and save the output to a file. In a file I have a list of all the network device names that have to be connected to using SSH. I then have to run ...
1
vote
0answers
102 views

Expect can not expect the output

I have problem with my simple code, the expect can not expect the output set timeout 10 set user username set password password spawn ssh $user@000.000.000.000 expect "Password:" send "$password\r" ...
0
votes
1answer
269 views

Counting files on a remote server with ssh and an expect script

Below is my script to take count for files which are present in remote server. But it is not working. Please help me. #!/usr/bin/expect spawn ssh sduser@172.0.0.2 expect "123" send "123" interact ...
3
votes
2answers
535 views

encfs with expect access denied

If I execute script #!/usr/bin/expect set pass [lindex $argv 0] spawn encfs -v {CRIPT_DIR} {MNT_DIR} -o nonempty expect "*EncFS Password:*" send "$pass\r" expect eof expect script output: ...
1
vote
1answer
642 views

Run expect script from other shell

My target is to create the /var/tmp/add_user.bash script from /var/tmp/create_script_add_user.bash script and run the expect script (add_user.bash) from create_script_add_user.bash script. The ...
1
vote
1answer
240 views

How to safely put user typed password into a file?

Is there any way to put the password typed by user into a file (either in Unix or in expect). read -s -p "enter password" input echo $input > file Is the above code safe? I want to use that ...
2
votes
1answer
3k views

error handling in expect?

I am just improving my quetion becasue i have acieved so far upto this: set username [lindex $argv 0] set password [lindex $argv 1] set hostname [lindex $argv 2] if {[llength $argv] == 0} { ...
3
votes
3answers
8k views

How to auto type password for SCP or SFTP to automate it?

I have script where I put scp command to backup file to other server. But when it runs it asking to type password. Is there way to automate this? I am using CentOS 5.6. I have seen few guides they use ...
4
votes
3answers
15k views

Shell Script for logging into a ssh server

I tried writing a shell script which can do automatic login into a ssh server using password which is mentioned in the script. I have written the following code: set timeout 30 /usr/bin/ssh -p 8484 ...
3
votes
1answer
4k views

sftp a file using shell script

I have read through several threads (which have been helpful) and I'm still getting an error when trying to sftp a file (client wants it to be sftp'ed) Here is the script: #!/bin/bash ...
0
votes
1answer
520 views

How to create auto vote script using `expect`?

I'd like to test auto-vote protection on my site (not published yet). I've found Expect program, but I can't get it working with telnet http.
2
votes
1answer
499 views

How to get the PID from a spawned process in expect?

Example: In a shell script I open a SSH tunnel whit this: /usr/bin/expect <<EOD set timeout -1 spawn ssh -fNL localhost:1873:localhost:873 HOST expect "*?assword:" { send "$SSHPASS\r"} sleep 2 ...
1
vote
2answers
255 views

Automate creation of an at job using expect

I am trying to write a script that will take time and process-name and pass them to at to schedule the job. I cannot send the EOT. #! /usr/bin/expect # Usage: setupkill.exp time process. ...
1
vote
2answers
3k views

SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine

I am trying to automate the deploy of some .deb packages with an script. I want to execute sudo dpkg -i $myDeb.deb in a list of remote machines I can access with ssh. I've tried to automate the ...
1
vote
2answers
650 views

How to meet required dependencies in order to install expect pecl extension on Mac OS X?

I am attempting to install the expect pecl extension. OS version = 10.7.3 PHP version 5.3.10 installed via macports expect version 5.45 installed via macports The command I am executing: ...
1
vote
1answer
999 views

Run expect inside a bash script as another user

I am writing a bash script to install some small software I'm developing. That script is run with sudo (as root), but some of the commands that are executed by the script need (or should be) run with ...
3
votes
4answers
1k views

passing passwords to a script

I want to scp a file to a remote host, and from there, run a command on the file, and exit the remote session. If I write a usual script, call scp and then ssh, I am prompted to enter two passwords. ...
2
votes
3answers
2k views

Pass the background flag (&) through expect and ssh

My command line/bash fu is extremely weak, but I'm trying to hone my abilities. Hopefully someone can help. I wrote a super simple expect script so that I can SSH in to a headless box we're using at ...