Solved

Ksh Statement with muliple and \or conditions

Posted on 2010-09-13
2
1,106 Views
Last Modified: 2013-12-26
Hi,

I'm trying to write an if statement that has 3 'and' conditions combined with an 'or' for an additional 3 'and' conditions i' have tried a bracketting the statements but either get syntax errors or it hits the first condition and breaks out of the if statement. I've hit a bit of a wall and can't work out what to do nextto make it work. below is the last attempt that failed:

if [ [[ $dbname = PD_EUDW ] && [ $DAY = SAT ] && [ $HOUR > 19 ]] ||
         [[ $dbname = PD_EUDW ] && [ $DAY = SUN ] && [ $HOUR < 20 ]] ]
       then    
              echo $(date +%H:%M:%S) "            " $dbname ":" $Daily ".....Hourly Collection BLACKOUT IN FORCE " >> $LOGFILE
       else
                  echo $(date +%H:%M:%S) "         " $dbname ":" $Hourly ".....Hourly Collection Running " >> $LOGFILE
                  db2 "call perform.$Hourly('$dbname','$DB2DATE')" >> $LOGFILE
fi

0
Comment
Question by:paulpen
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 250 total points
ID: 33660335
if [[  $dbname = PD_EUDW  &&  $DAY = SAT  &&  $HOUR > 19 || $dbname = PD_EUDW  &&  $DAY = SUN  &&  $HOUR < 20 ]]
0
 

Author Closing Comment

by:paulpen
ID: 33660372
quick response - excellent!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question