Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Browsing index pages (159 articles)

Shell (.exp) script only sending 1 of 2 files

I have a bash shell script that runs via cron. The script looks for 1 of 6 possible (data) files in a directory. If 1 or more of these files is found, a new (control) file is created for each data file...

View Article


Get the output from expect script in a variable

I have an expect script which provides the IP address:#!/bin/expect -fset nodename [lindex $argv 0]spawn virsh console $nodenameexpect "Escape character is"send "\n"expect "localhost login: " { send...

View Article


How 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

Expect 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 Article

Expect 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 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 Article

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

Looking 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 Article


How 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 Article


Automate 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 Article

Exiting 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 Article

expect 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 Article

Automating 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 Article


Shell 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 Article

expect 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 Article


Correct 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 Article

Expect 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 Article


Why 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 Article

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 Article

Waiting until an application is reading (over a TTY)

I'm writing an expect-style program to interact with a command-line application on Linux. Is there any way that my program can know when the application on the other side of the PTY tries to perform a...

View Article
Browsing index pages (159 articles)


Latest Images