What's wrong here? (Beginner's script)

Hi Folks,

New member here. I have been using UNIX systems for the past ~4 years (Linux, AIX, HP-UX, mostly) but have never had the need to write a script for myself. Now, things have changed and I'm in a bit of a pickle. I have, what looks to me like a syntactically correct script that's not quite working exactly as I'd hoped. It's for the BASH shell. Here's where it's failing:

i=0
while [ $i -lt $count ]
do
  trap "ctrlc" SIGINT SIGTERM
  if [ "$i" -eq 0 ]; then
    date > new && ps -o user,pid,command | grep $PATTERN | grep -v ps >> new
    cat new
  else
    mv new old
    date > new && ps -o user,pid,command | grep $PATTERN | grep -v ps >> new
    diffProc()
  fi
  i=$(($i+1))
  echo
  sleep 10
done

The error I'm getting is:

Line 62 is the 'fi' following the call to diffProc(). I've looked at several BASH tutorials and the if statement here seems to be well-formed. I've turned on debugging but that doesn't really say much more than the error, except for the values of some variables. Any assistance you could give me would be greatly appreciated. Thank you.

diffProc is a function call.

Just call it as

diffProc

and not as

diffProc()

I knew it had to be something stupid like that. Thanks, matrixmadhan. My Java background definitely came into play there.