what you gave is checking only in the first file i.e) only checking in /home/test/www.yahoo.com and coming out, and not checking in the remaining two files i.e) /home/test/www.gmail.com and /home/test/www.hotmail.com.
So, it has to search pattern "username" in all the file one by one till the test.txt gets empty or reach the bottom line of it.
dir=/home/test
while read MAIL
do
PERSONAL_MAIL=$dir/www.$MAIL.com
ACCOUNT=$(grep -c mail $PERSONAL_MAIL)
if [ -z "$PERSONAL_MAIL" ]
then
if [ -z "$ACCOUNT" ]
echo "$PERSONAL_MAIL is avaiable "
else
echo "$PERSONAL_MAIL not avaiable "
fi
fi
done < test.txt
above script is not searching for all the line in test.txt and content of the file is as like below
Above script doesn't even run but errors out. If the syntax error has been corrected, there still remains a logical flaw (actually it occurs twice). Those corrected, it processes all three entries in your test file.