Help On Unix Script Count Line Of File

I have to compare the number of files of two files on a Shell Script:
I tryied with wc and wiith sed but I can not make an integer...

#!/bin/sh
.
.
n = ls -l | wc -l $file1
`echo "Line: "$n". ">>$LOGFILE`

xx = sed -n '$=' $file2
`echo "Line: "$xx". ">>$LOGFILE`

Aways ERRORRRRR!!!!!!!!!

Can enybody help me with this problem and explane to me how to use an output as an integer?

TK's alot

[my file names does have eleven lines]

> cat comp_val
#! /bin/bash

file1=names
LOGFILE=test.log

n=$(ls -l | wc -l $file1)
echo "Line: "$n". ">>$LOGFILE

xx=$(sed -n "$=" $file1)
echo "Line: "$xx". ">>$LOGFILE

> rm *.log
> comp_val
> cat *.log
Line: 11 names.
Line: 11.
>

Thenk's a lot for the response, but it still give me a:

...../Send..sh: syntax error at line 167: `n=$' unexpected

it looks like it doesn't like:
n=$(ls -| | wc -l $file)

any other suggestions, also because after I need to do some arithmethic operations with n, like:
n=$n-9

tk's again

That is because you are using sh and trying to use bash specific constructs. This should work with sh:

$ cat ./comp_val
#!/bin/sh

file1=names
file2=${file1}.tmp
LOGFILE=test.log
cp $file1 $file2

n=`ls -l | wc -l $file1 |awk '{print $1}'`
echo "In $file2: Line: ${n}." > $LOGFILE

xx=`sed -n '$=' $file2`
echo "In $file1: Line: ${xx}. ">> $LOGFILE

echo "$n-2="`expr ${n} - 2` >> $LOGFILE

cat $LOGFILE
$
$
$ ./comp_val
In names.tmp: Line: 8.
In names: Line: 8.
8-2=6

HTH

It works perfect!!!

Thank you very much, it help me a lot!