Mulitiple conditions in While Do loop.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Mulitiple conditions in While Do loop.
# 1  
Old 03-10-2009
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
# 2  
Old 06-21-2009
Do you need it in a while loop? Why not something like:
if [datedifference <= 7] enter while loop, else send email.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Conditions in if

I'm using the below one.. #!/bin/ksh File=$3 if ; then echo "Script" elif ] ;then echo "Passed k or f option" else "Please check the Input passed" fi Command line argument is "k" or -f and file is exist then... (3 Replies)
Discussion started by: Roozo
3 Replies

2. Shell Programming and Scripting

While loop reading file with multiple conditions

Hi Am trying to print the PIDs of process in a file and trying to grep any PID from that file I set the if condition as $value != "PID" and $value != "-" Assign that number to a variable Am confused since am using while loop to read the line from file and again if condition to check those... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

3. Shell Programming and Scripting

Errors in if conditions with to many OR conditions

Hi ALL I have a script where in i need to check for several values in if conditons but when i execute the script it throws error such as "TOO MANY ARGUMENTS" if then msg="BM VAR Issue :: bmaRequestVAR=$bmaRequestVAR , nltBMVAR=$nltBMVAR , bmaResponseVAR=$bmaResponseVAR ,... (10 Replies)
Discussion started by: nikhil jain
10 Replies

4. Shell Programming and Scripting

If conditions need

Dear Expert, Below code is for to take the backup of database by daily time stamp. I need vital help to make my script automatic sending me email if it sucess or fail. echo on @REM Seamonkey's quick date batch (MMDDYYYY format) @REM Setups %date variable @REM First parses month, day, and... (6 Replies)
Discussion started by: Alone
6 Replies

5. Shell Programming and Scripting

Conditions in 'for' Loop

Hey guys, I've been learning shell for a few weeks now & come across an issue in one of my for loops : However I wish to add a condition (maybe if loop is best ??) when, if the variable value $line is > 24 go back to the start of my 'for' loop thus skipping my application based commands and... (3 Replies)
Discussion started by: phil0316
3 Replies

6. Shell Programming and Scripting

IF OR with two conditions

I have this IF working fine, testing if a char is a digit: if ; then _VALUE=$_VALUE$_CHAR else _ISDIGIT="false" fi Then I add a second condition to test if the char is either a digit or a * if ]; then _VALUE=$_VALUE$_CHAR ... (11 Replies)
Discussion started by: Flavius
11 Replies

7. Shell Programming and Scripting

conditions

./script 89 The script will extract the last digit of the input parameter. example, that is 4. This will be compared to the last digit of the current day of the month ( like day 14; that is 4). A message will displayed on the screen indicating if the digits are the same or not. (1 Reply)
Discussion started by: singh is king
1 Replies

8. UNIX for Dummies Questions & Answers

2 or more if conditions

Hello, I have a file as follows: col no:1 2 3 4 5 6 7 8 9 10 11 a 4 226 226 ch:95024048-95027592, 1y224 of 3545 223 224 ident b 53 235 235 ch:148398-148401255, 1y184 of 3187 180 186 ident awk... (3 Replies)
Discussion started by: dr_sabz
3 Replies

9. Shell Programming and Scripting

Search Mulitiple String pattern in a file

Hi, I need to search for a multiple string pattern(5 key words) in a file(similar to a flat file) ,and i need to store the output in a another file . In that file we may have mutiple occurrences of the key words.and i need only the unique. kindly help out. Thanks, Mohana Krishnan (2 Replies)
Discussion started by: krishnan_6015@y
2 Replies

10. IP Networking

Mulitiple Nic's

Hi, I'm running HPUX 11.0 on a machine with two Nic's. Everytime I install UNIX I select the card I want as the primary but it doesn't show up. When I do a ioscan it shows both cards but the card I want is listed as UNCLAIMED UNKNOWN how can I change this? Magnus (2 Replies)
Discussion started by: Magnus
2 Replies
Login or Register to Ask a Question