02-08-2006
35,
0
Join Date: Dec 2005
Last Activity: 22 November 2017, 5:48 AM EST
Posts: 35
Thanks Given: 2
Thanked 0 Times in 0 Posts
Problem with if logic
Hi there,
In my shell program I have two if statements
the first one checks that the date in yyyymm format is equal to a date from the parameter file in yyyymm format, and that the file and sends an appropiate email
The second one checks that the date in yyyymm format is equal to a date from the parameter file in yyyymm format, and that the new file size is greater the the previous file size and sends an appropiate email
The problem I have is that I get BOTH emails sent; below is the code and the values of the variables - can anyone see what I have done wrong
#month is same but file bigger new data so mail
if [ $cursize -ge $prvsize -a $curdate -eq $prvdate ]; then
subject="New Three Hour Calls for `date +%b %Y`"
mail_report $REPORTTXT
fi
#Month and file size are the same warning email no file send
if [ $cursize -eq $prvsize -a $curdate -eq $prvdate ]; then
echo "In same data email clause"
subject="No New Three Hour Calls for `date +%b%Y`"
mail_report $REPORTTXT
Current month date is 200602 - curdate
Previous Size is 417 - prvsize
Current Size is 417 - cursize
PRevious month date is 200602 - prvdate
An ideas as to what I'm doing wrong