Expect: print a multi-line string all at once using echo
I have the following section in my code expect code:set command "echo $output"spawn bashexpect "$ "send "$command\r"expect "$command\r\n"Where output is a multi-line string obtained from...
View ArticleWhy does unbuffer -p mangle its input?
$ seq 10 | unbuffer -p od -vtc0000000 1 \n 2 \n 3 \n 4 \n 5 \n 6 \n 7 \n 8 \nWhere did 9 and 10 go?$ printf '\r' | unbuffer -p od -An -w1 -vtc \nWhy was \r changed to \n?$ : | unbuffer -p printf '\n' |...
View ArticleExpect stuck after issuing exit command from application
Normally when in interactive mode, when I type in exit, it displays Disconnected from Virtual Machine 'pick0:LINUX' and then returns to the bash shell prompt.With my expect script, it is stuck on...
View ArticleCorrect way to set PS1 prompt over ssh
I am trying to set the PS1 prompt dynamically on the my remote machine. The idea is that when I will do ssh to the remote machine, I will also send the value which will set as a prompt for that remote...
View Articleexpect script sending password before prompt
I have written a small expect script for automatic ssh to remote server. But sometimes my expect script don't work. Actually it sends password before password prompt. Here is my script#!/usr/bin/expect...
View ArticleShell 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...
View ArticleAutomating SSH login with expect
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 Articleexpect script regular expression not working
In expect script I am trying to capture some text from outputText in output is like ivalue=16ef7baa-0de1-48bf-9e04-d486defbee1c,code:expect -re {^(ivalue)\=(.*)(\,)$}puts "expect_out (0, string)"output...
View ArticleExiting an Expect Script
I have this expect script, that will log into a host, run a command, return it's contents and exit. What sort of cleanup/proper exiting needs to happen when I've finished running my command? This...
View ArticleAutomate passing JBOSS installer arguments using Expect Command
I have a JBOSS Installer which when run manually it will prompt for input and below is the sample of the execution is as below[sp@sp baseInstaller]$ ./advStart.sh configBuildfile:...
View ArticleHow to use EXPECT in a loop for ssh
Our Linux setup doesn't have keygen configured for passwordless authentication. Hence I am supposed to use only EXPECT for passwordless authentication in a shell script. /usr/bin/expect<<EOF...
View ArticleLooking for assistance in expect
I have a bash script that has expect to login to a remote host and run list of commands. It works as expected. It has a flaw, if the user enters the wrong password, the expect script keeps trying the...
View Articleexpect - repeatably send "\n\r" before a match expect
I need to netcat a U-Boot and perform NAND script and I use below scriptspawn netcat -lup 6666expect "Hit any key to stop autoboot" #autoboot counts down from 3 to 0 and somehow one or two send won't...
View Article'expect' not matching server response string
I'm using a bash script to log into a telnet server and execute a number of commands. It looks like:login_and_run.sh#!/bin/bashunset TELNET_USER_NAME_STRINGunset TELNET_PASSWORD_STRINGunset...
View ArticleExpect Script TCL ending early
I have the following expect script which works for the most part. I have it connecting to a Cisco switch (eventually a couple hundred) and configuring syslog servers. It checks to make sure that...
View ArticleExpect script with Xargs and multiple parameters
I have an expect script that will SSH into a list of routers.The expect script works on a list of routers in a file and is called from a bash script with xargs.Bash : script...
View ArticleHow might I make this expect script consistently work as expected?
I use an interactive wallet spectre-cli of Spectre, a coin similar toKaspa in its design.When I manually want to get the balance of my wallet I need to runspectre-cli and then connect, openfrom within...
View Article