Thanks again scrutinizer (and others) you have definately taught me a lot over the last few days. Only have only last "ambiguous redirect" error occurring which I should be able to figure out and I'm done, 3 week assignment done in 3 days woooot.
---------- Post updated at 08:32 AM ---------- Previous update was at 08:24 AM ----------
Jumped the gun there, this is not working
also tried
output of the first is ":deleted" second is "grep:deleted"
Okay, well this is more or less my first attempt at writing a shell script.
Anyways, here's my code:
cd ${PATH}
if
then
rm ${FILE}
./anotherScript
else
exit 1
fi
exit 1
Anyways, it's a pretty simple script that is supposed to search for the... (4 Replies)
Hello, i have a script which checks if the user entered 8 numeric characters in the form of YYYYMMDD (birth date). If the user entered any non numeric characters, an error will be displayed:
# Check to see if the 8 characters are all numbers
# If not show error essage
# And prompt user... (4 Replies)
Hi,
I want to use grep inside a test statement, but I am getting an error message.
Two variables
testvarNum=5
testvarNonNum=x
echo $testvarNum | grep *
The result of this is as follows:
5
However, when I try the following (i.e. to test if the variable is numeric or non-numeric):... (3 Replies)
This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
Hi all. I am trying to compare and filter two files. I have a bigfile.txt of names and ids and a smallfile.txt of ids only. What I am trying to do is use a while read loop to read the ids in the bigfile and then echo the name and id only if the id exists in the small file. Basically, I'm trying to... (5 Replies)
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)
Hi,
Is there a way to check if the openssl part of the below execution returns non zero without freezing the flow of the script ?
var1=$(echo | openssl s_client -connect $url 2>/dev/null | openssl x509 -noout -issuer -subject -dates)
echo $?
Output: 0
while i was expecting the... (2 Replies)
As an exercise, I'm trying to re-write this code without the compound square brackets, using grep and test. Need to know what to do about the "equal-tilde".
#!/bin/bash
# test-integer2: evaluate the value of an integer.
INT=-5
if +$ ]]; then
if ; then
echo "INT is zero."
else
if ; then... (17 Replies)
read a
if test grep EOF $a
then echo yes file
else
echo no
fi (1 Reply)
Discussion started by: iamsumibisht
1 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)