I am creating a script to check for 3 files in Directory, take the count of rows in them and mail if the rows exist.I have to send only one mail if either of these files have count, I am ending up sending 3 mails.
For Ex. I have these files
process_date.txt
thread_date.txt
child_date.txt
Iam doing something like
$1= process_date.txt
$2= thread_date.txt
$3= child_date.txt
if [ -f $1 ]
then
count1=`wc-l < $1`
if $count1 -ne 0 then mailx abc.com
fi
fi
if [ -f $2 ]
then
count2=`wc-l < $2`
if $count2 -ne 0 then mailx abc.com
fi
fi
if [ -f $3 ]
then
count3=`wc-l < $3`
if $count3 -ne 0 then mailx abc.com
fi
fi