Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
33 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
53 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
23 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
30 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, ...
0
votes
1answer
125 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
52 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
19 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
237 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
110 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
63 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
73 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
162 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
99 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
110 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
128 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
1k 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
203 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
79 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
86 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
947 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
2answers
573 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
435 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 ...
1
vote
2answers
6k 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
542 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
979 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 ...
2
votes
1answer
2k 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
242 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
160 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
894 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
883 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
959 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
473 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
266 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
183 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 << ...
4
votes
3answers
5k 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 ...
0
votes
2answers
2k 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 ...
2
votes
2answers
1k 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
136 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
401 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 ...
1
vote
1answer
1k 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
395 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
5k 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} { ...
2
votes
2answers
6k 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 ...
0
votes
1answer
250 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 ...
3
votes
3answers
2k 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
9k 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 ...
2
votes
2answers
3k 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, ...
0
votes
1answer
647 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
642 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 ...
3
votes
2answers
706 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: ...