I am stuck in my script

Hi All

I have script that find 777 dir with specific extension like .php .Now after finding all 777 directory i will place in httpd.conf using a directory directive ,Now i was not do that,if directory entry exitst in httpd.conf then script ignor it dont show me at stdout else if it dont find directory entry in httpd.cong then alert me at stdout.I hope you understand what i mean below is my code take a look
For example this is in httpd.conf

<Directory "/var/www/html/abc">
some thing
</Directory>
<Directory "/var/www/html/xyz">
some thing
</Directory>

#!/bin/bash

check=/var/www/html
tail -n +993 /etc/httpd/conf/httpd.conf | grep  -H "Directory"  | awk -F" " '{ print $3 }' | sed 's/[">]//g' >> file.apache

while read line
do


        find $check -type d -perm /o=w | while read DIR
do

if [ "$line" != "$DIR" ]

echo "$line"
then
        test=$(cd "$DIR"; ls -A  *.php *.php3  2>/dev/null | wc -l)

                if [ "$test" != "0" ]
                   then
                        inject1="Bad Apache Dir ${DIR} $test"
                                                                                                      
                      echo $inject1
                fi
                fi


done
done < "file.apache"

The first thing I see is that you are breaking down the http.conf using awk with a space as a delimeter. You refer to $3. There is no third field. You have two fields per line.
field 1 - <Directory
field 2 - "/var/www/html/abc">

So if you remove the "> from the 2 field you should get a list of directories in the file.apache.

The second thing is to create a list of directories you have under /var/www/html/. This can be done by using your find command

find $check -type d -perm /o=w | while read DIR
do
   status=`grep -c $DIR file.apache`
   if [ "$status" -eq "0" ]
   then
     test=$(cd "$DIR";ls -A *.php *.php3 2> dev/null | wc -l)
     if [ "$test" != "0" ]
     then 
         inject1="Bad Apache Dir ${DIR} $test"
         echo $inject1
     fi
   fi
done

Thx you are genius.