The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
44 views

expect: does “” (spawn_id exp70) match glob pattern

I have written an expect script that works perfect for testing passwords on our network until it has looped through my list quite a bit, then the debug output shows that there is nothing to match. ...
1
vote
2answers
96 views

how to continue bash script execution when expect part is finished

I have bash script and inside it part with expect code: #!/bin/bash set -ex funct() { pass3="some_pass" expect -c " spawn su - oracle expect "Password:" send \"$pass3\n\" ...
5
votes
2answers
161 views

scp command behaves differently when used with expect utility

expect -c 'spawn scp -C -o CompressionLevel=9 ~/partFiles/* abc@10.200.4.15:/export/home/abc/; sleep 10; expect password; send "secretPassword\n";interact' throws - ~/partFiles/*: No such file or ...
0
votes
2answers
142 views

Expect Scripts - Reading from Files and Accepting User Input

How can I write an "Expect" script to: iterate over a list of IP addresses and log in to each to perform commands (like in a BASH for loop). Right now I just copy/pasted the few lines that are my ...
1
vote
0answers
127 views

Why the output is not written to log from expect script

I am trying to write the output of the netcat command including the command also to a file by logging into remote servers. But it is not writing. What am I missing ? #!/usr/bin/expect -f set user ...
3
votes
3answers
3k views

spawn - command not found!

I am using Mac OS X 10.9.4, following is my script to copy files from local machine to different host #!/bin/bash #!/usr/bin/expect echo "I will fail if you give junk values!!" echo " " echo "Enter ...
1
vote
1answer
58 views

Automating setup of the SSH tunnel

I need to frequently login to many machines but I can only login to them from a proxy machine or using an SSH tunnel (by tunneling through that proxy machine). The problem is that I cannot use ...
2
votes
1answer
268 views

ssh and run script on remote host and answer expect answer automate

The ssh from server0 to (server1,server2,server3) (no password need to SSH (trust exists between all servers and private key exists on all servers)) but a remote script on server (server1,server2 ...
0
votes
2answers
220 views

Use a script for a telnet session

I have a problem with my script. It seems my password is wrong. #!/usr/bin/expect set ip [lindex $argv 0] spawn telnet $ip set timeout 10 expect "Login:" send "administrator\r" expect "Password:" ...
1
vote
0answers
31 views

How do I securely automate inputting passwords?

I would like to automate an SSH connection so that I wouldn't have to enter password and I am not allowed to use authorized_keys. I was thinking about making an expect script but I don't know where I ...
1
vote
0answers
130 views

bash - expect and variables

I have the followin: while read line; do userinfo=$(echo $line | sed 's/@/,/') IFS=',' read -a address <<< "$userinfo" userid="${address[0]}" domain="${address[1]}" ...
0
votes
1answer
1k views

Expect script buffer output not showing

How can I get the command output from the buffer? Current'y it's just saying "(buffer). Here is my script and debug output: #!/bin/bash -x while read p; do echo $p { /usr/bin/expect -d << ...
1
vote
2answers
231 views

How do I expect 'echo -e “? \c”'?

I'm an absolute newbie to the UNIX world and have been asked to write a script that interacts with another one - but I'm stuck. The script that I interact with echos the following and I need to send a ...
0
votes
1answer
80 views

Expect works fine,but only in foreground why?

I use this script for update my repo slackware(generate asc,txt,etc) http://slackware.org.uk/people/alien/tools/gen_repos_files.sh I have "automated" it with my expect script #!/bin/sh set -e ...
2
votes
3answers
85 views

Extracting time from logs using tcl, expect

I have logs with the following pattern: 1,30.10.2014,07:51:07,0,0,1,12,28,255,3,255,255,255,0,0,0; 2001,30.10.2014,07:51:07,0,0,0,300,5,0,255; I need to extract date and time... for the first line ...
1
vote
2answers
163 views

Expect script: How to handle two processes?

I am using Expect to automate VoIP calls for quality measurements. My script is calling another VoIP client for a given amount of times. Before the calls should be handled, tcpdump should sniff all ...
2
votes
1answer
91 views

Deadlock with yes command

I have a script called setup.sh: . install.sh && . tolinux.sh && . startn.sh && . startm.sh This is install.sh: yes | sudo apt-get update yes | sudo apt-get install ...
1
vote
1answer
54 views

WinRAR installer.rar situation (automating expect install)

I'm writing a script that should set up a server with no user input. Whatsoever. In order to automate installation of some programs, I used expect. However, what can I use to automate expect ...
0
votes
0answers
117 views

Expect script variable matching ruined by a space

I'm trying to automate some operations with the VC systems I administer, and the manufacturer has MANY inconsistencies in their interface. I'm trying to match a system H323 name and device name, ...
1
vote
2answers
1k views

Create a directory if it doesn't exist in TCL

I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory /var/cti/adm/APP exists. If APP not exists under adm ...
1
vote
1answer
212 views

TCL script try catch

I have a TCL script that sets a number of variables and reads several files. The last file it reads may contain sensitive information, so I need to make sure this file gets deleted even if an error ...
2
votes
0answers
35 views

unbuffer/expect swallows the rcode when its child is signaled

unbuffer is able to pass along the return code of a process under normal circumstance, but if the process you are unbuffering is killed, for instance with a segfault, I see $? as 0 while I expect 139. ...
0
votes
1answer
1k views

How to copy two files in expect script?

please advice why spawn scp $FILE1 $FILE2 $LOGIN@$IP:/tmp in my expect script copy only FILE1 and not copy FILE2 ? I try to to transfer both files by scp as scp file1.csv file2.crt ...
1
vote
2answers
222 views

When using expect: SSHFS Transport endpoint is not connected

When I run my SSHFS connection script from bash, everything works perfectly. However, when I run the same script using the expect utility, I get the following error when I try to access the folder ...
0
votes
0answers
133 views

Set terminal title within expect script

I use zsh as my shell, and I wrote an expect script to automate passing my password to ssh; it works perfectly, exept that the terminal window's title is set to the name of my script. I would like to ...
0
votes
0answers
112 views

Timeout does not work in expect script

I created the following expect script in order to automate logging into a VPN: #!/usr/bin/expect set PASS [lindex $argv 0] set timeout 10 spawn vpnc expect : {send $PASS\r} ...
3
votes
1answer
308 views

how to get exit status from command in expect script

Below is an shell script I have written to automate entering the password for the vpnc command. The expect works fine and vpnc activated automatically after password entered, but I need to get the ...
1
vote
1answer
199 views

Expect script: remove password on private key

I'm trying to remove the password on a private key. Doing it by hand is simple, I run this command and enter the password : openssl rsa <newkey.pem > newkey-no-password.pem I'm trying to do ...
2
votes
1answer
179 views

SSH Command behaves differently in Expect Script

I'm using this command on Server1 ~# ssh root@Server2 /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys to append the contents of Server2's id_rsa.pub to the authorized_keys of Server1. It ...
1
vote
1answer
252 views

How can I return a specific error code at this point in my TCL script?

I have a TCL expect script that runs a scp command for uploading a config file to my DNS server: #!/usr/bin/expect -f set config "~/dnsmasq.conf" spawn /usr/bin/scp "$config" ...
1
vote
1answer
2k views

Shell script to perform telnet session to ser2net

I have setup a xenserver (free) hosting a VM (Debian 7.5). On this xenserver I have attached a serial GSM modem. I have configured xen to run ser2net so I have a serial proxy available. This works ...
0
votes
1answer
343 views

Expect script + automated telnet process between three Linux machines

Is it possible to do the following by expect script? I have Linux server that connected to linux_machine1 and linux_machine1 connected to linux_machine2 My Linux server have access only to ...
2
votes
1answer
120 views

Problem on running Script on host after connecting

I am new to linux scripting. Please help. I searched on below a lot but was not able to find appropriate answer : I am trying to make a script which I will later schedule as cronjob, so that it keeps ...
2
votes
1answer
121 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 ...
1
vote
1answer
2k views

grep IP addresses in expect script

This is part of code in an expect script, I have a problem with searching IP addresses from a file whose name is in the variable $filename. #!/usr/local/bin/expect -- ###Made by Etihkru#### set ...
0
votes
3answers
3k 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 ...
1
vote
2answers
772 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 ...
2
votes
2answers
10k 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
729 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 ...
7
votes
2answers
2k 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
1answer
9k 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 ...
3
votes
1answer
334 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. ...
2
votes
2answers
303 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 ...
5
votes
1answer
1k 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
2k 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
2k 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
747 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
355 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
260 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 << ...
5
votes
3answers
12k 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 ...