Solved

Ksh Statement with muliple and \or conditions

Posted on 2010-09-13
2
1,104 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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