Script giving wrong results....

hi,

I have this script which gives me the result...

#! /usr/bin/sh
set -x
cd /home/managar
a=1
while true
do
if [ -a log.txt ]
then
echo " File log.txt exists in this directory "
exit 0
fi
echo " File has not arrived yes..."
sleep 3
let a=a+1
if [ $a -gt 5 ]
then
echo " File has not arrived in time.....only header will be placed in the target location...."
exit 1
fi
done

and this script which is also giving me the same result.....

#! /usr/bin/sh
set -x
cd /home/managar
a=1
while true
do
if [ -a log.txt ]
then
echo " File log.txt exists in this directory "
exit 0
fi
echo " File has not arrived yes..."
sleep 3
let a=a+1
if [ a -gt 5 ]
then
echo " File has not arrived in time.....only header will be placed in the target location...."
exit 1
fi
done

the only difference is that in the If condition i ignored $ value for a but yet it gives me the same result......do not know why...?
does anybody know why....?????

Thanks,

Not sure that I understand, but your second script has "if [ a -gt 5 ]" instead of "if [ $a -gt 5 ]".