If statement falling over on a null record. Help please.

Okay i've got some code which reads a text file and loops through it and there a few if statements inside where one is failing (the one bolded).

Basically the acc column contains a list of three digit access codes, some though have null records (i.e nothing in the field) so what I want to do is if its not null to carry on to the other loops if it is null to move on to the next record.

I thought -n meant if the value is greater than 0 in length. I.e not null.

When it gets the the first null record i get the following error message

create_matrix_busy.exe: test: argument expected

This is my code so far...

while read line
do
sdate=`echo "$line" | cut -d, -f1`
edate=`echo "$line" | cut -d, -f2`
edate=`echo "$line" | cut -d, -f2`
site=`echo "$line" | cut -d, -f3`
NA=`echo "$line" | cut -d, -f4`
acc=`echo "$line" | cut -d, -f6`
calls=`echo "$line" | cut -d, -f8`
if [ -n ${acc} ]
then
if [ ${calls} -gt 0 ]
then
if [ ${NA} = 'ALL' ]
then
echo ${site},${acc}
elif [ ${NA} = 'NA*' ]
then
echo ${site},NA${acc}
fi
fi
fi

Thanks, the code will do more inside the if statements once i get those working.

if [ -n "${acc}" ]

Thank you.

If you are using a Posix shell you should switch to the double square brackets test operator
e.g.

if [[ -n $acc ]]; then
echo \$acc defined
fi