Skip to main content

Questions tagged [expect]

Expect is a utility based on TCL. It's primary use is for building automation into interactive environments such as telnet or ssh based terminal environments. It provides the ability to enter commands on a command line and interpret the output.

14 questions with no upvoted or accepted answers
1 vote
2 answers
14k views

Ansible expect not working for multiple prompt values

I need to install nginx agent for openam using ansible. while install the nginx_agent it asking multiple question while run the script, **********************************************************...
Rajkumar .E's user avatar
1 vote
1 answer
941 views

sending GREP command fails

I'm new to expect scripting and trying to get below script to work. The script logs in to a server and reads a config file ($val in the script) for the values of "cps" and then presents a total value, ...
Dalman's user avatar
  • 11
0 votes
0 answers
139 views

How to display output from expect?

I'm trying to read data from a machine that uses a telnet style interface using expect. An interactive telnet session works like this: % telnet 10.92.177.14 53595 Trying 10.92.177.14... Connected to ...
Elliott B's user avatar
  • 1,265
0 votes
1 answer
107 views

What's the best way to replay keystrokes on to my terminal?

I find myself having to do a series of ssh in order to get to a particular host. What I currently do is to copy and paste the commands into the terminal, one after the another, like a machine. I'm ...
Jeenu's user avatar
  • 266
0 votes
1 answer
336 views

expect spawn command: Escaping newline (\n) in string

I am trying to use expect to interact with the MATLAB console. Currently I have: #!/usr/bin/expect -f spawn {*}/usr/bin/run.sh matlab -r "fprintf(1, \"The identifier was:%s\\\\n\", \&...
user3711775's user avatar
0 votes
1 answer
5k views

Setting and using a variable within a single-line Expect command in a Bash script

I have an array, $HOSTS, which contains a set of hostnames. I have a database table that has a set of IP addresses. I want to go through each IP address in that table and send a command (hostname -s) ...
Kefka's user avatar
  • 1,456
0 votes
0 answers
156 views

Is it possible to detach and re-attach to a spawned process using separate expect processes?

I have an expect script that spawns a process, then does some initialization (authentication), then performs some task that needs prior authentication. Considering to extend the script to execute ...
U. Windl's user avatar
  • 705
0 votes
0 answers
292 views

Bash automation SFTP script not moving the last file once in a while

I have developed a bash script for moving files to FTP only when a particular CSV is available in remote server. A job from another Data quality tool calls this script. Script is working fine, but it ...
Syam Sundar's user avatar
0 votes
0 answers
601 views

Obexctl: Provide different result in terminal and script

I have created a script where I want to send file over bluetooth. For that I took "obexctl" utility. I can transfer file using obexctl utility over terminal. But when I'm trying to incorporate the ...
Nikita's user avatar
  • 101
0 votes
1 answer
3k views

How to handle a condition when an expect script executing another script on a remote host is interrupted?

Im using an expect script to say xyz.exp to login to a remote host and execute another script abc.sh Now most of the times abc.sh runs fine, but there is a scenario where if a certain condition is ...
user417721's user avatar
0 votes
1 answer
440 views

Bash function only works when password manually input

At work I have to run the following function everyday. The function works fine when I am prompted for the password. However, I tried to hardcode my password so that I don't have to enter it in each ...
N Klosterman's user avatar
0 votes
0 answers
173 views

Simple Expect program to send a key when the program yields some text

I need to run this program: Luis@Windu /cygdrive/c/Temporal/Expect$ oclhashcat64 ../Test.hccap -m 2500 -a 3 ?d?d?d?d?d?d?d?d oclHashcat v1.31 starting... Device #1: Bonaire, 1024MB, 1050Mhz, 12MCU ...
Sopalajo de Arrierez's user avatar
0 votes
1 answer
1k views

How do I build a script shell to send cmd via telnet and log only results?

I would like to make a shell script that can call a range of IPs via telnet, to send a command, and write the result to a file.
Simon's user avatar
  • 1
0 votes
1 answer
2k views

Using EXPECT script with a $ in the password

I'm trying to set a variable in a Linux bash script which includes a $ symbol, i.e. password is Gl@d1us$123 so PASS="Gl@d1us\$123". I can preceed the $ with a \ and it works fine, but when it calls ...
Andy Kendall's user avatar