How to verify all user home directories are writable only by their owner

Hi, I'm currently working on my school assignment on how to verify that all user home directories are writable only by their owner on Solaris with VMware. But I'm not sure why my codes take a very long time to display the results. My friend says it's the `su - $i -c "ls -ld" 2> /dev/null | grep ^d | awk '{print $1}'` part that is causing the problem but his not sure what to do either. Can someone please help me? Thanks.

#!/usr/bin/bash
clear
echo " Verifying if user home directories are writable only by their owner"
echo

TEMPFILE=/permgrep.txt
TEMPFILE2=/namegrep.txt
accno=0
h=1
no=1
Ps=0
Fs=0

if [ ! -f ${TEMPFILE} ]
then
touch ${TEMPFILE}
fi

if [ ! -f ${TEMPFILE2} ]
then
touch ${TEMPFILE2}
fi

ACCOUNTS=`cat /etc/passwd | awk -F: '{print $1}'`
array=($ACCOUNTS)

for i in "${array[@]}"
do
let "accno += 1"
PRINTER=`su - $i -c "ls -ld" 2> /dev/null | grep ^d | awk '{print $1}'`
if [ -n "$PRINTER" ]
then
echo $PRINTER >> $TEMPFILE
echo $i >> $TEMPFILE2
fi
done

echo

for line in $(cat /permgrep.txt)
do

READTF2=`head -$h /namegrep.txt | tail -1`

if [ $line == 'drwxr-xr-x' ]
then
echo $no"-"$READTF2": PASS"
let "h += 1"
let "Ps += 1"

else
echo $no"-"$READTF2": FAIL"
let "h += 1"
let "Fs += 1"
fi

let "no += 1"

done

nohodi=`expr $accno - $Ps - $Fs`

echo " Total user accounts: "$accno
echo " Pass: "$Ps
echo " Fail: "$Fs
echo " no home directory : "$nohodi

rm /namegrep.txt
rm /permgrep.txt

There is a special forum for homework. Please repost there according to the rules for posting homework.