File number count

hi all
i want to count the number of files in a particlar dir i have wrote the codes as below

 
fileCount= ls | wc -l
if [ $fileCount -eq 0 ]
then 
echo " "
elif [ $fileCount -gt 0 ]
then 
echo " "
fi

however when i excute the program
there are error happens " unary operator expected"
i just woundering

fileCount= ls | wc -l

will ls | wc -l store into my variable fileCount?

thanks for helping

fileCount=`ls | wc -l`

or on bash

fileCount=$(ls | wc -l)

try this,

fileCount=`ls | wc -l`
echo $fileCount

although i seem to remember having to pipe to sed as well to remove all the blank spaces that wc returns

Calypso

thanks for helping
It works nicely ^^

You don't need any external commands, let alone two of them:

set -- *
echo $#