Whats wrong with this script?

Hi all,

#!/bin/ksh

BIN=/interface/Gunner

age=$1

directory="$2"

[ "$directory" = "" ] && directory=.

cd "$directory" || exit 1

from=`$BIN/today -$age`
cd $BIN
for i in `cat filestoarchive.txt`;do
cd $i
find . -mtime 14 | grep -v '.tar$' | $BIN/dttmfilter | awk '$1<="'$from'"{ print;};' | \
done

while read d t f
do
   [ -d $f ] && continue
   opt=u
   [ -w $d.tar ] || opt=c
   tar ${opt}f $d.tar $f && touch -r $f $d.tar && rm -f $f
done

I got this message:Syntax error at line 19 : `done' is not expected

Is it wrong to have two while statements?The first while statement grabs the files that were modified 14days ago...

Thanks

The first "while" is missing. Not quite sure where is your first "while" for your loop.

I have for there instead of the while. Now I fixed it. The find . -mtime should come after done NOT before.