12-19-2008
test is no program to test if your shell script works. test is used with or without "if" for example, to test if a condition is true or not, to implement a logical flow into scripts. In your script, that smells like homework/classroom stuff, are some loads of "if" tests already. Best talk to your teacher again and tell him that your task is not clear to you.
By the rules of this forum, homework/classroom stuff is forbidden:
(6) Do not post classroom or homework problems.
which you can read here:
The UNIX and Linux Forums - Forum Rules
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi everyone,
I am new to UNIX and scripting, and I have some problems with the test command.
when i try to execute the command:
test 20070327.gz > 20070320.gz
i try to make a charachter string comparison between the two strings or the two files, to make sure that 20070327.gz is greater than... (2 Replies)
Discussion started by: marwan
2 Replies
2. AIX
Hello,
I am trying to add some tests to existing code. The code already contains some test commands. An example is as follows...
] then
Does anyone know the purpose of the double equals? I would have used a single equals sign... (2 Replies)
Discussion started by: JWilliams
2 Replies
3. Shell Programming and Scripting
I have been looking into searching various files to display output.
The search criteria will be a month and year to output various numbers in the files.
is there any way to do this with the TEST function or would it have to be another way? (4 Replies)
Discussion started by: amatuer_lee_3
4 Replies
4. Shell Programming and Scripting
Plese help me on the below query.
for j in *.20071231* *.ctl *.dat
do
(
if then
cp "$base/*.*" "$base1"
fi
)
done
My requirement is for all files that has extension *.20071231* *.ctl *.dat
should be copied to another folder.
But those with caaa.20071231.log... (7 Replies)
Discussion started by: sussane
7 Replies
5. Programming
I'm very new to C and could use a little help.
I'm testing to make sure the command is running as it's proper name, if not then fail.
if (strcmp(argv, "xinit") != 0) {
fprintf(stdout, "name = %s length = %d\n",argv,l);
usage(0);
}
This works if the command is... (3 Replies)
Discussion started by: nck
3 Replies
6. UNIX for Dummies Questions & Answers
How do i tell my bash shell script to test the output of the command i'm using?? I want this script to look for lines not equal to 1 then let me know..
$ cat blah ; echo ---- ; cat blah.sh
1 fe
1 fi
1 fo
0 fum
1 blahda
1 blah
0 blahh
1 bla
1 bl
1 blahhh
----
#!/bin/bash
while... (1 Reply)
Discussion started by: phpfreak
1 Replies
7. Shell Programming and Scripting
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)
Discussion started by: Max89
1 Replies
8. Shell Programming and Scripting
How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies
9. Shell Programming and Scripting
hello,
i'v trying to use the TEST command and i have some problems with it.
i am trying kill all proccess wich is greater than 25.
i started with - ps -f | grep -v TTY | awk '{print $4}'
but i dont know how to proceed from here..
10x a lot, Daniel. (11 Replies)
Discussion started by: dadiT
11 Replies
10. Shell Programming and Scripting
Hello,
I need help with a test command.
Here is what I am trying to do :
I've got an interactive script that check if configuration files exist on 2 different directories, then all configuration files are print on screen by a short name.
My problem is when you type a "wrong name" or... (12 Replies)
Discussion started by: Aswex
12 Replies
LEARN ABOUT DEBIAN
test::html::w3c
Test::HTML::W3C(3pm) User Contributed Perl Documentation Test::HTML::W3C(3pm)
NAME
Test::HTML::W3C - Perform W3C HTML validation testing
SYNOPSIS
use Test::HTML::W3C tests => $test_count;
# or
use Test::HTML::W3C 'show_detail';
# or when using both
use Test::HTML::W3C tests => $test_count, 'show_detail';
is_valid_markup($my_html_scalar);
is_valid_file("/path/to/my/file.html");
is_valid("http://example.com");
# Get the underlying WebService:;Validator::W3C::HTML object
my $validator = validator();
DESCRIPTION
The purpose of this module is to provide a wrapper around the W3C that works with the Test::More testing framework.
ABUSE
Please keep in mind that the W3C validation pages and services are a shared resource. If you plan to do many many tests, please consider
using your own installation of the validation programs, and then use your local install by modifying the local validtor:
my $v = validator();
$v->validator_uri($my_own_validator);
See the documentation for WebService:;Validator::W3C::HTML and the W3C's site at http://validator.w3.org/ for details
validator();
Description: Returns the underlying WebService::Validator::HTML::W3C object
Parameters: None.
Returns: $validator
plan();
Description: Access to the underlying "plan" method provided by Test::Builder.
Parameters: As per Test::Builder
is_valid_markup($markup[, $name]);
Description: is_valid_markup tests whether the text in the provided scalar value correctly validates according to the W3C
specifications. This is useful if you have markup stored in a scalar that you wish to test that you might get from using LWP or
WWW::Mechanize for example...
Parameters: $markup, a scalar containing the data to test, $name, an optional descriptive test name.
Returns: None.
is_valid_file($path[, $name]);
Description: is_valid_file works the same way as is_valid_markup, except that you can specify the text to validate with the path to a
filename. This is useful if you have pregenerated all your HTML files locally, and now wish to test them.
Parameters: $path, a scalar, $name, an optional descriptive test name.
Returns: None.
is_valid($url[, $name]);
Description: is_valid, again, works very similarly to the is_valid_file and is_valid_file, except you specify a document that is
already online with its URL. This can be useful if you wish to periodically test a website or webpage that dynamically changes over
time for example, like a blog or a wiki, without first saving the html to a file using your browswer, or a utility such as wget.
Parameters: $url, a scalar, $name, an optional descriptive test name.
Returns: None.
diag_html($url);
Description: If you want to display the actual errors reported by the service for a particular test, you can use the diag_html
function. Please note that you must have imported 'show_detail' for this to work properly.
use Test::HTML::W3C 'show_detail';
is_valid_markup("<html></html">, "My simple test") or diag_html();
Parameters: $url, a scalar.
Returns: None.
SEE ALSO
Test::Builder::Module for creating your own testing modules.
Test::More for another popular testing framework, also based on Test::Builder
Test::Harness for detils about how test results are interpreted.
AUTHORS
Victor <victor73@gmail.com> with inspiration from the authors of the Test::More and WebService::Validator::W3C:HTML modules.
BUGS
See http://rt.cpan.org to report and view bugs.
COPYRIGHT
Copyright 2006 by Victor <victor73@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
perl v5.12.4 2011-08-22 Test::HTML::W3C(3pm)