Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

that because of following lines

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

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 

Or more clear is short circuit :

docs=$(grep -i "Number.*processed" $files | cut -d" " -f5 || echo 0)
share|improve this answer

Your Answer


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.