Hi ,
reading a "file1" with 2 data in each line (VAR1 and VAR2) , i'm using a while loop like this :
cat file1|awk '{print $1,$2}'|while read VAR1 VA2
do
echo $VAR1
echo $VAR2
done
as this example shows , it works but if between do and done i use
a "rsh" command , the script reads... (6 Replies)
Hi
I use the following command to check if my_base is active or not :
active_db=`${LOCAL_BIN}/ssh -l ${my_user} ${my_service} "ps -ef | grep ora_smon | grep ${my_base} | sed -e \"s/ */ /g\" | cut -d'?' -f2 | cut -d' ' -f3 | cut -d'_' -f3"`
When I use a file listing databases to check them... (1 Reply)
Hi,
whenever I am giving a 'ls' command system is going into infinite loop displaying the current home directory.
There is no separate shell script/file with ls name anywhere in the system.
I am using Solaris 10.
Any help / guidance in solving this problem is highly appreciated.
... (3 Replies)
Having some trouble with usage of for loop and displaying words. Basically I had 3 words( some times more )
in the variable. I want to get one at a time to process.
I am new to unix scripting so please bear with my question and appreciate your reply. I think this can also me done my awk... (1 Reply)
I have a script that users a while read, whithin this I want to execute the cp -i command on some of the results, however because it is in a loop it skips the -i part of cp. How do I get the loop to stop each time cp -i is run and wait for the user to type the response. (2 Replies)
Hi
I want to display "echo command value in loop" in single line. My requirement is to show the input file (test_1.txt) like the output file (test_2.txt) given below.
Input file :test_1.txt
a1|b1|4|5
a1|b1|42|9
a2|b2|32|25
a1|b1|2|5
a3|b3|4|8
a2|b2|14|6
Output file:test_2.txt... (2 Replies)
Hello!
I've got a loop in which I am processing a list of values gotten through a file with read command.
It seems that instead of processing the lines (values) one by one, I process them all together.
the input file is:
20
20
20
80
70
70
20
The code is: (2 Replies)
I have a below command
ALTER TABLE `abc` ADD PARTITION ( PARTITION 20130613 VALUES less than (DAY('13')));
Below is requirement
It runs in Loop
as DAY start with 13 and end with 100 along with this of counter "20130613" also increases per command
as the next command should be
... (8 Replies)
HI Folks -
I'm very frustrated - I'm trying to execute a verys imple for loop and rename the files if they exist.
here is my loop :
ydate=`TZ=aaa24 date +%m%d`
CR_YR=$(date "+%Y")
echo $ydate
echo ${CR_YR}
cd... (6 Replies)
Discussion started by: SIMMS7400
6 Replies
LEARN ABOUT DEBIAN
io::async::test
IO::Async::Test(3pm) User Contributed Perl Documentation IO::Async::Test(3pm)NAME
"IO::Async::Test" - utility functions for use in test scripts
SYNOPSIS
use Test::More tests => 1;
use IO::Async::Test;
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
testing_loop( $loop );
my $result;
$loop->do_something(
some => args,
on_done => sub {
$result = the_outcome;
}
);
wait_for { defined $result };
is( $result, what_we_expected, 'The event happened' );
...
my $buffer = "";
my $handle = IO::Handle-> ...
wait_for_stream { length $buffer >= 10 } $handle => $buffer;
is( substr( $buffer, 0, 10, "" ), "0123456789", 'Buffer was correct' );
DESCRIPTION
This module provides utility functions that may be useful when writing test scripts for code which uses "IO::Async" (as well as being used
in the "IO::Async" test scripts themselves).
Test scripts are often synchronous by nature; they are a linear sequence of actions to perform, interspersed with assertions which check
for given conditions. This goes against the very nature of "IO::Async" which, being an asynchronisation framework, does not provide a
linear stepped way of working.
In order to write a test, the "wait_for" function provides a way of synchronising the code, so that a given condition is known to hold,
which would typically signify that some event has occured, the outcome of which can now be tested using the usual testing primitives.
Because the primary purpose of "IO::Async" is to provide IO operations on filehandles, a great many tests will likely be based around
connected pipes or socket handles. The "wait_for_stream" function provides a convenient way to wait for some content to be written through
such a connected stream.
FUNCTIONS
testing_loop( $loop )
Set the "IO::Async::Loop" object which the "wait_for" function will loop on.
wait_for( $condfunc )
Repeatedly call the "loop_once" method on the underlying loop (given to the "testing_loop" function), until the given condition function
callback returns true.
To guard against stalled scripts, if the loop indicates a timeout for 10 consequentive seconds, then an error is thrown.
wait_for_stream( $condfunc, $handle, $buffer )
As "wait_for", but will also watch the given IO handle for readability, and whenever it is readable will read bytes in from it into the
given buffer. The buffer is NOT initialised when the function is entered, in case data remains from a previous call.
$buffer can also be a CODE reference, in which case it will be invoked being passed data read from the handle, whenever it is readable.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::Test(3pm)