hi friends,
i wrote one simple shell script.. in that am using for loop... when i am trying to execute the script[ksh-x filename].it shows syntax error at for loop line '((' unexpected.
#!/bin/ksh
##
##### To find no of files in the directory
NOF=`ls -l /root/COMM/LOGS/eds/20081025| wc -l`
if [ $NOF -ne 0 ]
then
NOF=`expr $NOF - 1`
fi
OUTFILE= /root/temp/checking/outputfile
#OUTFILE= /root/temp/checking/outputfile
echo " /root/COMM/LOGS/eds/20081025 no of files is ${NOF} " > $OUTFILE
if [ $NOF -ne 0 ]
then
for ((i=1; $i<=`cat /root/temp/checking/address.txt|wc -l`; i++ ))
do
TO=`head -$i /root/temp/checking/address.txt | tail -1`
MFILE=/root/temp/checking/mailfile
echo "From: "Gnanaprakasam" <gnanaprakasam@xyz.com>" > $MFILE
echo "To: ${TO}" >> $MFILE
echo "Date: `date`" >> $MFILE
echo "Subject: due to the script execution problem " >> $MFILE
echo -e "\n\n" >> $MFILE
echo "Dear Sir/Madam," >> $MFILE
echo -e "\n\t Due to the script execution problem the following file are created" >> $MFILE
echo -e "\n\n `ls -lt /root/COMM/LOGS/eds/20081025 | tr -s " " | cut -f 6,7,8,9 -d " "`" >> $MFILE
echo -e "\n" >> $MFILE
##/bin/cat $MFILE | /usr/sbin/sendmail -fgnanaprakasam@xyz.com $TO
sleep 2
done
fi