for loop is wrong (actually it will run, but for will pass FILE to commands and difened variables used with $)
for $i in `ls $FILES` do # this will pass ls output one by one to the command
and using ` you can assign output of programs to variables easily.
example:
ls -d /home | grep -i ozan will output /home/ozan/ on my system
if i write this OZANHOME=`ls -d /home | grep -i ozan` OZAHOME will be /home/ozan/ (that slash would create some problems).
if statements are like this:
if [statement]; then
do something
else
do something else otherwise
fi
for statement part where you do tests: look at
this, IBM wrote such nice document