Hi All- I have written a shell script to send birthday wish mail to all my colleagues.
I need help from you all in two things,
-
I need to add some 17 birthday images as my team size is 17 i want to send different images for everyone. (I dont know how to do it)
-
I need to send mail to 17 people but i know the command to send only 1 at a time
Could you please alter my script according to my requirement and share me?
Thanks,
Bala
#!/bin/bash
LIMIT=3
IFILE="/apps/fresco/BALACHANDAR/bday.csv"
OFILE="bday_out"$$
MAILID=balachandar.sedouramane@gmail.com
for i in 1 2 $LIMIT
do
arr[$i]=`date '+%d-%b' -d "$i days"`
done
while IFS=",-" read name day month year
do
for DAT in ${arr[@]}
do
DAY=${DAT:0:2}
MON=`echo ${DAT:3:3} | awk '{print toupper($0);}'`
day=`printf "%02d\n" $day`
month=`echo $month | awk '{print toupper($0);}'`
if [ $day -eq $DAY -a $month = $MON ]
then
echo $name : $DAT
break;
fi
done
done < $IFILE > $OFILE
if [ -f $OFILE -a -s $OFILE ]
then
sed -i '1i The users celebrating their birthday are:\n' $OFILE
mailx -s "Birthday List: " $MAILID < $OFILE
\rm $OFILE
echo "Birthday mail sent"
else
echo "No birthdays."
fi
---------- Post updated at 07:22 AM ---------- Previous update was at 07:20 AM ----------
Bday.csv file :
Happy Birthday BALA11-Sep-89User207-Jul-89User315-Jun-95