Guys,
I am having problem reading from a subscriber's file to send out email according. Below is my codes:
###################### Subscribers File ##################
mohd.ali@linux.net
mtyson@linux.net
hiroka@linux.net
##################### end ##################################
Above file is saved as mail.sub
then i have another file, query.sh, which contains a while loop that reads line by line of mail.sub file to determine information of users in a Oracle database. Here's the code:
############################################################
while read line;
do
echo "$line"
user=`echo ${line} | awk '{print $1}'`;
sqlplus -s test/test @extract_user_info $user;
echo " This is a testing " > mailbody.$user
mailx -s "User info for $user" ${user} < mailbody.$user;
fi
done
##################### end ##################################
in order to execute the code, I type in:
$cat mail.subs | query.sh
However, I am only able to get the 1st email send out. The remaining two users does not get executed. I am wondering what is going on? Any one to enlighten me?
I am having problem reading from a subscriber's file to send out email according. Below is my codes:
###################### Subscribers File ##################
mohd.ali@linux.net
mtyson@linux.net
hiroka@linux.net
##################### end ##################################
Above file is saved as mail.sub
then i have another file, query.sh, which contains a while loop that reads line by line of mail.sub file to determine information of users in a Oracle database. Here's the code:
############################################################
while read line;
do
echo "$line"
user=`echo ${line} | awk '{print $1}'`;
sqlplus -s test/test @extract_user_info $user;
echo " This is a testing " > mailbody.$user
mailx -s "User info for $user" ${user} < mailbody.$user;
fi
done
##################### end ##################################
in order to execute the code, I type in:
$cat mail.subs | query.sh
However, I am only able to get the 1st email send out. The remaining two users does not get executed. I am wondering what is going on? Any one to enlighten me?