08-23-2011
This User Gave Thanks to pludi For This Post:
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I wnat to assign a set of values to a variable
and
use it in if condition.
for example:
i=$1
d=1 2 3 4 5 6
if
then
echo "Fine"
else
echo "Check"
fi
i will either of the value in d, i.e. i can be 1 or 2 or any value in d, How this can be done?
Thanks in advance (2 Replies)
Discussion started by: sol_nov
2 Replies
2. Shell Programming and Scripting
I have an two arrays. One array BINDIST consists of fences. I have another array XOFFS.
Eg
BINDIST = 0 10 20 30 40 50 60
XOFFS = 2 3 4 23 25 28 55 58
I want to find to find the indices of values in XOFFS that are closest to each BINDIST.
My idea is to do as follows
I create array... (7 Replies)
Discussion started by: kristinu
7 Replies
3. Programming
Hi,
I'm trying to set two OID's in the same PDU (so both OIDs and values are sent in the same packet) at present I am only able to send one at a time which does not trigger the hardware response as the two specific OID's need to be set simultaneously in order to work.
I'm using perl along... (0 Replies)
Discussion started by: MCLASS
0 Replies
4. UNIX for Dummies Questions & Answers
Hello.
In csh if I declared a variable to be a set of arguments can I retrieve a particular element from that set.
My code
set files=(`ls`)
and I want to get only one file from $files. How can I do that????(It is just an abstract example):wall:
Thanks in advance :) (5 Replies)
Discussion started by: FUTURE_EINSTEIN
5 Replies
5. Shell Programming and Scripting
I am new to ksh scripting, specially array. How do i get values from an array and set the value as variable and pass those variables to the different functions??
someone taught me how to get input from a file with have columns i need to read, but now i doesnt know how to set those value to be a... (7 Replies)
Discussion started by: gavin_L
7 Replies
6. Shell Programming and Scripting
Hi everyone,
This is an exemple of inpout.txt file (a "," delimited text file which can be open as csv file):
ID, Code, Value, Store SP|01, AABBCDE, 15, 3 SP|01, AABBCDE, 14, 2 SP|01, AABBCDF, 13, 2 SP|01, AABBCDE, 16, 3 SP|02, AABBCED, 15, 2 SP|01, AABBCDF, 12, 3 SP|01, AABBCDD,... (1 Reply)
Discussion started by: jeremy589
1 Replies
7. Shell Programming and Scripting
Can some one please help me with the syntax in shell script for the below :
if $var1 exists in ('val1','val2','val3')
I want to execute a set of commands if the value of var1 variable matches any one of the given string values. Please let me know if there are any other option to go by.
... (10 Replies)
Discussion started by: Pandee
10 Replies
8. UNIX for Beginners Questions & Answers
Hello,
I am writing a script which expects as its input a hash with student names as the keys and marks as the values. The script then returns array of average marks for student scored 60-70, 70-80, and over 90.
Output expected
50-70 1
70-90 3
over 90 0
The test script so far... (4 Replies)
Discussion started by: nans
4 Replies
LEARN ABOUT DEBIAN
ledgersmb::dbtest
LedgerSMB::DBTest(3pm) User Contributed Perl Documentation LedgerSMB::DBTest(3pm)
NAME
LedgerSMB::DBTest - LedgerSMB commit filter for test cases.
SYOPSIS
This module creates a DBI-like interface but ensures autocommit is off, and filters commit statements such that they don't do anything.
This can be used for making API test cases which involve DB commits safe for production environments.
USAGE
Both LedgerSMB.pm and LedgerSMB/Form.pm assign a global database handler for all database access within a script in the dbh property (for
example, $request->{dbh} or $form->{dbh}). By setting this early to a LedgerSMB::DBTest (instead of a DBI object), the tests can be made
safe.
However, there are a few limitations to be aware of. One cannot run tests through the standard request handler and use this module. Hence
this is limited to unit tests of files in the LedgerSMB, scripts, and bin directories.
Here is an example of how this could be done:
my $lsmb = LedgerSMB->new();
$lsmb->merge($testdata);
my $dbh = LedgerSMB::DBTest->connect("dbi:Pg:dbname=$company", "$username",
"$password",)
$lsmb->{dbh} = $dbh;
METHODS
connect($dsn, $user, $pass)
Connects to the database and returns a LedgerSMB::DBTest object
commit()
Tests the current transaction (issues a 'SELECT 1;' to the database). If this is successful returns 1, if not, rolls back and returns
false.
Note that this means all past tests are rolled back and this is inconsistent with normal transactional behavior.
prepare()
Returns a statement handle, via the private DBI database handle.
do()
passes this statement on to the private database handle
errstr()
passes this call on to the private database handle
err()
passes this call on to the private database handle
quote()
passes this call on to the private database handle
quote_identifier()
passes this call on to the private database handle
rollback()
passes this call on to the private database handle. Note that this will roll back all statements issues through this object.
perl v5.14.2 2010-03-02 LedgerSMB::DBTest(3pm)