Sponsored Content
Top Forums Shell Programming and Scripting What's wrong with this condition Post 302606235 by gull04 on Saturday 10th of March 2012 06:12:20 AM
Old 03-10-2012
Hi try

Code:
if [[ -n `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ]] && [[ -d `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ]]

There should be no spaces between the square brackets.

Regards

Dave

Last edited by gull04; 03-10-2012 at 07:14 AM.. Reason: Incomplete
This User Gave Thanks to gull04 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Please tell me what do I do wrong here!

#!/usr/bin/csh # DAY=`date +%y%m%d` H=`date +%H` M=`date +%M` mailx -s "$H-Myfile" email@email.com</home/mydir/myfile Thanks! (4 Replies)
Discussion started by: bobo
4 Replies

2. Shell Programming and Scripting

Anything wrong with this

Does anyone see anything wrong with this. #getInfraFiles() #{ # cd Infra/$DAY # rm * # /usr/bin/ftp -i -n $LINE << cmd # user "$USER" "$PASSWD" # cd $INFRAPATH # binary # mget * # bye #} besides that its commented out (4 Replies)
Discussion started by: rcunn87
4 Replies

3. UNIX for Dummies Questions & Answers

What am I doing wrong?

I really just mess around in UNIX, for the most part, when I want to get something done. I can usually piece things together by searching for brief how-to's on Google, but the syntax errors in my following .sh file are really confusing me. I've got lots of programming experience in other places, so... (7 Replies)
Discussion started by: demonpants
7 Replies

4. Shell Programming and Scripting

Whats wrong with this IF condition?

I have four variables, dumpdata, defndata, compare1 and compare2 I want an IF statement condition which returns true when either dumpdata=defndata or (dumpdata<=compare1 and dumpdata>=compare2). But this is not working for me.. if (4 Replies)
Discussion started by: indianjassi
4 Replies

5. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

6. Shell Programming and Scripting

syntax of if condition in ksh is wrong

The syntax of 'if' conditionals in bash and ksh seems different. I am trying to check for a particular version using 'if' in ksh. This very simple syntax gives syntax error. I have tried many variants, but no go. Please correct the syntax. Later I will expand it to 'if' and 'else'. #!/bin/ksh... (8 Replies)
Discussion started by: nivedhitha
8 Replies

7. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

8. Shell Programming and Scripting

What's wrong with this condition

if Please indicate the problem with this code Thanks in advance :) (4 Replies)
Discussion started by: ezee
4 Replies

9. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

10. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
Test::NoWarnings(3pm)					User Contributed Perl Documentation				     Test::NoWarnings(3pm)

NAME
Test::NoWarnings - Make sure you didn't emit any warnings while testing SYNOPSIS
For scripts that have no plan use Test::NoWarnings; that's it, you don't need to do anything else For scripts that look like use Test::More tests => x; change to use Test::More tests => x + 1; use Test::NoWarnings; DESCRIPTION
In general, your tests shouldn't produce warnings. This modules causes any warnings to be captured and stored. It automatically adds an extra test that will run when your script ends to check that there were no warnings. If there were any warings, the test will give a "not ok" and diagnostics of where, when and what the warning was, including a stack trace of what was going on when the it occurred. If some of your tests are supposed to produce warnings then you should be capturing and checking them with Test::Warn, that way Test::NoWarnings will not see them and so not complain. The test is run by an "END" block in Test::NoWarnings. It will not be run when any forked children exit. USAGE
Simply by using the module, you automatically get an extra test at the end of your script that checks that no warnings were emitted. So just stick use Test::NoWarnings; at the top of your script and continue as normal. If you want more control you can invoke the test manually at any time with "had_no_warnings". The warnings your test has generated so far are stored in an array. You can look inside and clear this whenever you want with "warnings()" and "clear_warnings", however, if you are doing this sort of thing then you probably want to use Test::Warn in combination with Test::NoWarnings. use vs require You will almost always want to do use Test::NoWarnings If you do a "require" rather than a "use", then there will be no automatic test at the end of your script. Output If warning is captured during your test then the details will output as part of the diagnostics. You will get: o the number and name of the test that was executed just before the warning (if no test had been executed these will be 0 and '') o the message passed to "warn", o a full dump of the stack when warn was called, courtesy of the "Carp" module By default, all warning messages will be emitted in one block at the end of your test script. The :early pragma One common complaint from people using Test::NoWarnings is that all of the warnings are emitted in one go at the end. While this is the safest and most correct time to emit these diagnostics, it can make debugging these warnings difficult. As of Test::NoWarnings 1.04 you can provide an experimental ":early" pragma when loading the module to force warnings to be thrown via diag at the time that they actually occur. use Test::NoWarnings ':early'; As this will cause the diag to be emitted against the previous test and not the one in which the warning actually occurred it is recommended that the pragma be turned on only for debugging and left off when not needed. FUNCTIONS
had_no_warnings This checks that there have been warnings emitted by your test scripts. Usually you will not call this explicitly as it is called automatically when your script finishes. clear_warnings This will clear the array of warnings that have been captured. If the array is empty then a call to "had_no_warnings()" will produce a pass result. warnings This will return the array of warnings captured so far. Each element of this array is an object containing information about the warning. The following methods are available on these object. o $warn->getMessage Get the message that would been printed by the warning. o $warn->getCarp Get a stack trace of what was going on when the warning happened, this stack trace is just a string generated by the Carp module. o $warn->getTrace Get a stack trace object generated by the Devel::StackTrace module. This will return undef if Devel::StackTrace is not installed. o $warn->getTest Get the number of the test that executed before the warning was emitted. o $warn->getTestName Get the name of the test that executed before the warning was emitted. PITFALLS
When counting your tests for the plan, don't forget to include the test that runs automatically when your script ends. SUPPORT
Bugs should be reported via the CPAN bug tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-NoWarnings <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-NoWarnings> For other issues, contact the author. HISTORY
This was previously known as Test::Warn::None SEE ALSO
Test::Builder, Test::Warn AUTHORS
Fergal Daly <fergal@esatclear.ie> Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2003 - 2007 Fergal Daly. Some parts copyright 2010 - 2011 Adam Kennedy. This program is free software and comes with no warranty. It is distributed under the LGPL license See the file LGPL included in this distribution or http://www.fsf.org/licenses/licenses.html. perl v5.14.2 2011-12-01 Test::NoWarnings(3pm)
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy