I am trying to use expect command in my shell script and it works fine if I have only expect. To it if I add a custom function which calls a PL/SQL procedure the shell errors saying
In the script the first line I have is
(the path where I have my expect utility)
If I remove this the script errors at my expect lines.
File_Entry is a custom function added to make an entry of the file transferred into a table. Like wise I will be doing few more activities by calling few more custom functions before and after sftp. The sftp script will be spwaned in the script as
How to over come this error and make the script to execute both my expect as well the custom function
I need to run a remote application(GUI) in a client.i.e on running a script in the client machine i should get the GUI application which is running in the server by providing password through the script.Will expect or autoexpect command suit for this scenario?
could anyone help me by posting some... (0 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)
Hello hello, did a quick search and didn't turn up anything helpful. I've got a book I'm sure has the answers, but I don't think I'll have time to finish it before this all has to work, so here goes~ if this isn't a good place to post and someone could direct me to another forum I'd appreciate... (1 Reply)
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)
Hello All,
I am trying to automate an installation process using expect and sh script. My problem is that during the installation process the expected value can change according to the situation.
For Example if this is a first time installation then at step 3 I'll get "Do you want to accept... (0 Replies)
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 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
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)
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)
Hi All,
i am trying to ssh to a remote machine and execute certain command to remote machine through script.
i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as
expect: spawn id exp5 not open
while executing
"expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies
LEARN ABOUT DEBIAN
test::sql::translator
Test::SQL::Translator(3pm) User Contributed Perl Documentation Test::SQL::Translator(3pm)NAME
Test::SQL::Translator - Test::More test functions for the Schema objects.
SYNOPSIS
# t/magic.t
use FindBin '$Bin';
use Test::More;
use Test::SQL::Translator;
# Run parse
my $sqlt = SQL::Translator->new(
parser => "Magic",
filename => "$Bin/data/magic/test.magic",
...
);
...
my $schema = $sqlt->schema;
# Test the table it produced.
table_ok( $schema->get_table("Customer"), {
name => "Customer",
fields => [
{
name => "CustomerID",
data_type => "INT",
size => 12,
default_value => undef,
is_nullable => 0,
is_primary_key => 1,
},
{
name => "bar",
data_type => "VARCHAR",
size => 255,
is_nullable => 0,
},
],
constraints => [
{
type => "PRIMARY KEY",
fields => "CustomerID",
},
],
indices => [
{
name => "barindex",
fields => ["bar"],
},
],
});
DESCSIPTION
Provides a set of Test::More tests for Schema objects. Testing a parsed schema is then as easy as writing a perl data structure describing
how you expect the schema to look. Also provides maybe_plan for conditionally running tests based on their dependencies.
The data structures given to the test subs don't have to include all the possible values, only the ones you expect to have changed. Any
left out will be tested to make sure they are still at their default value. This is a useful check that you your parser hasn't accidentally
set schema values you didn't expect it to.
For an example of the output run the t/16xml-parser.t test.
Tests
All the tests take a first arg of the schema object to test, followed by a hash ref describing how you expect that object to look (you only
need give the attributes you expect to have changed from the default). The 3rd arg is an optional test name to pre-pend to all the
generated test names.
table_ok
field_ok
constraint_ok
index_ok
view_ok
trigger_ok
procedure_ok
CONDITIONAL TESTS
The "maybe_plan" function handles conditionally running an individual test. It is here to enable running the test suite even when
dependencies are missing; not having (for example) GraphViz installed should not keep the test suite from passing.
"maybe_plan" takes the number of tests to (maybe) run, and a list of modules on which test execution depends:
maybe_plan(180, 'SQL::Translator::Parser::MySQL');
If one of "SQL::Translator::Parser::MySQL"'s dependencies does not exist, then the test will be skipped.
EXPORTS
table_ok, field_ok, constraint_ok, index_ok, view_ok, trigger_ok, procedure_ok, maybe_plan
TODO
Test the tests!
Test Count Constants
Constants to give the number of tests each *_ok sub uses. e.g. How many tests does field_ok run? Can then use these to set up the test
plan easily.
Test skipping
As the test subs wrap up lots of tests in one call you can't skip idividual tests only whole sets e.g. a whole table or field. We
could add skip_* items to the test hashes to allow per test skips. e.g.
skip_is_primary_key => "Need to fix primary key parsing.",
yaml test specs
Maybe have the test subs also accept yaml for the test hash ref as its a much nicer for writing big data structures. We can then define
tests as in input schema file and test yaml file to compare it against.
BUGS AUTHOR
Mark D. Addison <mark.addison@itn.co.uk>, Darren Chamberlain <darren@cpan.org>.
Thanks to Ken Y. Clark for the original table and field test code taken from his mysql test.
SEE ALSO perl(1), SQL::Translator, SQL::Translator::Schema, Test::More.
perl v5.14.2 2012-01-18 Test::SQL::Translator(3pm)