I am trying to use a very simple expect script to automate entering one or two details into a console connection of a solaris machine so that I can do a boot net - install.
If I run the console connection script manually myself, it connects fine and when I hit enter, I am on the machine and can log in etc.
Problem is, when I spawn this exact same command from within expect, the connection seems to work but when I hit enter, nothing
What might be different about spawn, than running script from the command line.
Hi
I've stumbled over something that caught my attention but I'm not familiar enough with IPs to know if this is suspect or irrelevant. If you'd take the time to read and respond I'd greatly appreciate it. I'm just stumped.
I've done a site for some people (4 in the group) awhile ago and set... (4 Replies)
Good Morning Fellow Admins!
I have a v880 running Sol9. The cron daemon is executing a crontab for a user and the user is in /etc/cron.d/cron.deny.
/etc/cron.d/cron.allow exists and the user is not in it.
What am I missing?
Thanks in Advance!
Tony (3 Replies)
Hello to all...this is my first post (so please go easy). :)
I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Hi,
Am very new to expect scripting..
Can You please suggest me how to call an expect script inside another expect script..
I tried with
spawn /usr/bin/ksh
send "expect main.exp\r"
expect $root_prompt
and
spawn /usr/bin/ksh
send "main.exp\r"
expect $root_prompt
Both... (1 Reply)
I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues:
set REMOTE "/root/scripts/remote"
...
log_user 1
send_user "Executing remote script as $user...\n"
send_user "Command to execute is: $REMOTE... (1 Reply)
Two SPARC servers running latest patches on S10U11. When the mysql account logs into either machine from a windows 7 workstation via putty or other ssh program, the first attempt works fine. Trying to ssh in from the same terminal a second time using either the mysql account or any other LDAP... (5 Replies)
Dear All,
I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
I'm fairly new to scripting so this might not be possible.
I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version:
#show version
... (0 Replies)
Discussion started by: IBGaryA
0 Replies
LEARN ABOUT DEBIAN
test::expect
Test::Expect(3pm) User Contributed Perl Documentation Test::Expect(3pm)NAME
Test::Expect - Automated driving and testing of terminal-based programs
SYNOPSIS
# in a t/*.t file:
use Test::Expect;
use Test::More tests => 13;
expect_run(
command => "perl testme.pl",
prompt => 'testme: ',
quit => 'quit',
);
expect("ping", "pong", "expect");
expect_send("ping", "expect_send");
expect_is("* Hi there, to testme", "expect_is");
expect_like(qr/Hi there, to testme/, "expect_like");
DESCRIPTION
Test::Expect is a module for automated driving and testing of terminal-based programs. It is handy for testing interactive programs which
have a prompt, and is based on the same concepts as the Tcl Expect tool. As in Expect::Simple, the Expect object is made available for
tweaking.
Test::Expect is intended for use in a test script.
SUBROUTINES
expect_run
The expect_run subroutine sets up Test::Expect. You must pass in the interactive program to run, what the prompt of the program is, and
which command quits the program:
expect_run(
command => "perl testme.pl",
prompt => 'testme: ',
quit => 'quit',
);
expect
The expect subroutine is the catch all subroutine. You pass in the command, the expected output of the subroutine and an optional comment.
expect("ping", "pong", "expect");
expect_send
The expect_send subroutine sends a command to the program. You pass in the command and an optional comment.
expect_send("ping", "expect_send");
expect_is
The expect_is subroutine tests the output of the program like Test::More's is. It has an optional comment:
expect_is("* Hi there, to testme", "expect_is");
expect_like
The expect_like subroutine tests the output of the program like Test::More's like. It has an optional comment:
expect_like(qr/Hi there, to testme/, "expect_like");
expect_handle
This returns the Expect object.
expect_quit
Closes the Expect handle.
SEE ALSO
Expect, Expect::Simple.
AUTHOR
Leon Brocard, "<acme@astray.com>"
COPYRIGHT
Copyright (C) 2005, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
perl v5.12.3 2011-06-12 Test::Expect(3pm)