Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have this piece of code given below as a part of my main script

if [ -e /tmp/rsm/Logs/filename_$$.txt ];
then
{
total=0
for files in $(<filename_$$.txt);
do
#cd /tmp/rsm/Logs
docs=`grep -i "Number.*processed" $files | cut -d" " -f5`
total=$(($total+$docs))
done
echo "---------------------------------------------------------"
echo  "Total Number Of Documents Processed On $date : $total"
echo "---------------------------------------------------------"
}
else
{
echo "There are "0" logfiles processed on $date"
}
fi

which gives the error

SDSLoad_onscreendocs.ksh[32]: 1024+: 0403-053 Expression is not complete; more tokens expected.

Please help me get rid of this error.

share|improve this question
add comment

1 Answer

that because of following lines

docs=`grep -i "Number.*processed" $files | cut -d" " -f5`
total=$(($total+$docs))

if docs variable is null then you will face this issue or might be docs having different value other than integer. so you need to check that manually or in debug mode.

also you can add one more checking, let say if docs if null then set zero eg.

[ -z $docs ] && docs=0 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.