Quantcast
Browsing all 157 articles
Browse latest View live

Linux shell scripting

I want to login to remote server and run multiple commands on the same and exit. As on the remote server I am not having root access, so I am unable to use sshpass. Hence I was trying to use expect...

View Article


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...

View Article


How to send variable value in send command of expect script

Below is my scriptproc sendline {line} { send -- "$line\r" }set slot 1set port 1for {set x 0} {$x<48} {incr x} { sendline {curl -X POST -d '{"command":"dumpcommand","slot": "$slot","port": "$port"}'...

View Article

Expect script error- extra characters after close-quote

Error while executing send if command, Not sure if I'm missing some tcl syntax.#!/usr/bin/expect -f# Get the list of hosts, one per line #####set f [open "/tmp/host.txt"]set hosts [read $f]close $f#...

View Article

How to run an expect script in parallel rather than sequentially?

#!/bin/expect --set vm_num [lindex $argv 0]puts "``````````````````````````````````````````````````````````````"puts "``````````````````````````````````````````````````````````````"puts "Registering...

View Article


TCL Expect Not Writing To Output Buffer

I have noticed that my TCL/Expect Script is not writing to the Output Buffer.`#!/usr/bin/expect -fexp_internal 1; #Debug Expectset username [lindex $argv 0]; #Takes Outside Argumentset password [lindex...

View Article

How to automatically add keyfile and passphrase to ssh-agent?

Linux 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/LinuxI use the script to start ssh-agent and start other script (which is using expect to sent passphrase to...

View Article

How to solve the issue that a remote Terminal screen is messed up when using...

Using expect and password auto-login to remote with ssh, when resizing the window, stty size report old size. Cause commands like vim and less mess up.

View Article


Expect in bash script?

Is there a way to use expect command directly in a bash script for which the automation is to be done, instead of writing a expect script and use spawn command to trigger the bash script from expect...

View Article


How to limit parallel jobs

I have a hosts containing file say /tmp/hostlist which requires username & password to login and I am using expect command to login hosts and execute command and come out like below in my bash...

View Article

Sending bunch of commands from txt file in Expect

How to send bunch of commands to Cisco router from txt file like:configureclass-map match-any popc_fiberpower004_booster_v4 match access-group ipv4 bng_permit_v4 match access-group ipv6...

View Article

How to increment for loop by 2 in Expect script?

I have this piece of code in bash script which is working perfectly fine and increment the variable by one. I want to be able to increment by two so that there are two registrations happening at once...

View Article

Expect script to power on ilo2, works fine but no exit

This is my script to power on a ILO2 HP server.Works fine(the server power on) but after the power on the ilo console remain open and I can exit from script only using ctrl+cby hand, so the script is...

View Article


expect freezes after send

I'm trying to automate a Alpine Linux installation using the following script:expect <<- EOF set timeout -1 spawn setup-disk -e -m sys /dev/sda expect { {WARNING: Erase the above disk(s) and...

View Article

How to give file name as current date in expect

I have wrote a script in expect as follows. I want to give date as variable to cd command but when I am giving the date as variable to the command and it add '' commas and therefore it shows a error as...

View Article


Using expect to write a bash script

I am trying to write a bash script using expect. This bash script will reside on a remote server, to be executed at a later date/time. I am using expect to read in a large data file, perform some...

View Article

How can I execute command that has three and/or optional answers in sequence?

I have command to execute: "sudo ssh -L 80:localhost:80 -f -N root@10.19.34.11" There are three options that in some case I get them and some not:password for jenkins user:"[sudo] password for...

View Article


Failed to execute command that has three and/or optional answers in sequence?

I have command to execute on Linux: sudo ssh -L 80:localhost:80 -f -N root@10.19.34.11There are three options that in some case I get them and some not:password for jenkins user:"[sudo] password for...

View Article

How to correctly use spawn-expect-send for 'git push'?

The code below is adapted from a solution to "Use Expect in a Bash script to provide a password to an SSH command", so as to pass arguments to git push. I'm not getting any exceptions for passing the...

View Article

How to detect the spawn failure in expect command

I wrote this script:#!/bin/shexpect -c "spawn cu -l /dev/ttyUSB0 -s 115200expect \"foo\"send \"bar\""echo $?And I run it without /dev/ttyUSB0:$ ls /dev/ttyUSB0ls: cannot access '/dev/ttyUSB0': No such...

View Article
Browsing all 157 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>