In bash `expect` script autogeneratedd with `autoexpect`, there is a `^G` -...
In bash expect script autogen'd with autoexpect,I am invoking line completion with a [TAB] in a situation where line completion offers no completions nor changes the input line. The script excerpt...
View Articlehow to send special characters in expect script?
I'm trying to send special characters (password) which contains #?!k;|C .The password is dynamic and cannot be hardcoded in the script, so I'm passing it as variable as shown below$ expect...
View ArticleUnix shell script using Expect shell
Im writing a script to collect micro code levels for adapters on each servers in AIX, using Expect shell. #!/bin/kshfor hostname in ABCD123 ABCD234 ABCD445doexpect << 'EOS'set hos...
View ArticleExpect script connects with ssh but does not run commands
I need to write a script that runs on a PC with Centos 7 and connects to another PC with Centos 7 using ssh, execute a console command, for example "ls -la" and save the output of it to a file to be...
View ArticleCommand puts in expect doesn't show the message in the order it should
I have a some scripts to automate a process and I want the message about which step I am in it shows in the command window. A piece of code I have is: puts "** Creation of $VMNAME on $HOST begins......
View Articlexclip not getting stdin from pexpect, or pexpect not sending?
Thisimport pexpectdef run(cmd, stdin): child = pexpect.spawn(cmd, encoding='utf-8') child.send(stdin) child.sendeof()run('xclip -selection clipboard', 'lol')should copy string lol into my clipboard, so...
View Articlesed error on expect script
I am trying to use a simple sed command inside with a expect scriptspawn sed -n '/0032ff00/,/clogoff/p' /tmp/file.tmp > /tmp/file.tmp1I get an error:sed: -e expression #1, char 1: unknown command:...
View Articlepexpect fails to match command if greater than 65 characters
Issue with pexpect, python module. Pexpect fails to do expected behavior if the length of the command is greater than 65.#!/usr/bin/pythonimport pexpectsshCmd='ssh root@15.186.22.105'prompt='[root@user...
View ArticlePassing parameters by shell script file to expect script
I need to pass a paramter from a shell script under command line of ssh scriptfor example : #!/usr/bin/expectspawn ssh user@servername.com "cm1+passingparameters.sh;cmd2"my existing script 123.sh which...
View ArticleUsing "expect" command to run an interactive program fails
I am trying to solve my question that I've asked here using expect script instead of file redirection. Unfortunately, this solution doesn't work as well (the same behaviour as described in the question...
View ArticleProblem with 'string match' and variable
I've been searching for hours and trying multiple things. This is the expect code snippet which works. foreach line [split $expect_out(buffer) \r\n] { if {[string match {*word*} $line]} { send_user...
View ArticleRemote Automation Tools in Linux
Suppose one has a computing environment, in linux, which is static and persistent. I have one-way ssh connections, and the infrastructure is trusted -- it is mine.There exist a variety of branded...
View ArticleExpect exiting, not responding to text sent
I have an expect script that is exiting, instead of processing text that is sent and installing files. I'm trying to figure out why it's not installing files, i.e. not implementing what would be done...
View ArticleHow to spawn parallel
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 ArticleHow 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 ArticleUse a script for a telnet session
I have a problem with my script. It seems my password is wrong.#!/usr/bin/expectset ip [lindex $argv 0]spawn telnet $ipset timeout 10expect "Login:"send "administrator\r"expect "Password:"send...
View ArticleStrange Output in Expect Recordings: How to eliminate, and any reasons why?
So, I have switched to Fedora from Debian recently, and have noticed something odd in the default Fedora BASH shell.If I run autoexpect and record commands, the following sorts of output gets...
View ArticleHow to use EXPECT in a loop foor ssh
Our Linux setup doesn't have keygen configured for password less authentication. Hence I am supposed to use only EXPECT for password less authentication in a shell script. /usr/bin/expect<<EOF...
View Articlespawn_id is empty when setting
I am running an except script where it spawns a c program, waits for an output from the program, and then spawns another program. After that program has finished, I want to send to the original program...
View ArticleLoad configuration file after ssh using expect
I'm trying to ssh into a remote host, load an environment variable in the .zshrc file on the host, then execute a command using that environment variable.Here's my script so far,#!/usr/bin/expect...
View Article