The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-10-2009
sud sud is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 12
Mulitiple conditions in While Do loop.

Hi guyz,

I have a WHILE loop which shud DO certain jobs when it satisfies the condition and it does…but I also need to assign a different job if it doesn’t satisfy the condition..how can I do this.Below is my script.


if [ `datecalc.ksh -a $sysdate - $vdt1` -ge 7 ];
then
echo "if statement"
while [ 7 -le `/erp/apps/infa/PowerCenter8.1.1/server/infa_shared/SrcFiles/datecalc.ksh -a $sysdate - $vdt2` ]# (This checks if the difference of dates is less than 7,it is exiting out of the loop if the date diff is > 7..I want to send an email if it is > 7 but where can I have that in a WHILE/DO loop? )
do
# vdt3 should be used in FTP Archive and rename #
vdt3=$(printf "%04d%02d%02d" $vdt2)
echo $vdt3
echo " in while loop"
# ----------------------------------------------------
# Set Environment for HEC Schema.
# ---------------------------------------------------
#Kicking off the STG workflow #
pmcmd startworkflow -sv SPRDEV23REP_Integration_Service -d Domain_ebi55rdv -u DEVUSER -p ******* -f CWT_STG -wait wf_tes
t
echo "Done pmcmd"
# Calling the rename files
#/erp/apps/infa/PowerCenter8.1.1/server/infa_shared/SrcFiles/cwt_rename_files_npc.sh $vdt3
echo $vdt3

#updating the date from the table
abc=`sqlplus -s A23300/******@ODSDEV553 <<eof
whenever sqlerror exit sql.sqlcode;
set serveroutput on;
UPDATE IBP_RES_NPC.LOAD_DATE
SET LOAD_DATE = TO_DATE('$vdt3','yyyymmdd');
COMMIT;
EXIT;
eof`

# while loop increment vdt2
vdt2=`/erp/apps/infa/PowerCenter8.1.1/server/infa_shared/SrcFiles/datecalc.ksh -a $vdt2 + 7`
echo $vdt2
done
fi

Thanks,
Sud