Solved

Ksh Statement with muliple and \or conditions

Posted on 2010-09-13
2
1,099 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
Comment Utility
if [[  $dbname = PD_EUDW  &&  $DAY = SAT  &&  $HOUR > 19 || $dbname = PD_EUDW  &&  $DAY = SUN  &&  $HOUR < 20 ]]
0
 

Author Closing Comment

by:paulpen
Comment Utility
quick response - excellent!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Red Hat script request 23 70
Need a python script 5 75
PERL - Find newest folder 12 100
improve Shell script 5 135
This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now