Avatar of paulpen
paulpen

asked on 

Ksh Statement with muliple and \or conditions

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

Shell Scripting

Avatar of undefined
Last Comment
paulpen
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of paulpen
paulpen

ASKER

quick response - excellent!
Shell Scripting
Shell Scripting

The term 'shell' refers to a general class of text-based command interpreters most often associated with the UNIX and Linux operating systems. Popular shells include Bourne, Debian Almquist (dash), Korn (ksh), Bourne Again (bash) and the C shell family (csh). Some view the DOS 'cmd' prompt as a minimal shell of sorts. It is also possible to install Cygwin on Windows and emulate a full Unix environment with complete shell capabilities. Terminal emulators, such as xterm, GNOME Terminal and OS X Terminal, can be used to access shell.

11K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo