Subing Variables with commands.

I'm back!
Ok, I'm trying to use a variable with a value of a unix command.
So when I try a=`ls`, then echo $a I get the correct answer.
But when I try it with a pipe:
a=`ls | wc -c`, then echo $a I get:
filename: a: command not found

I've tried so many ways I presumme it's the pipe that is confusing things.
Please help, or di I need to try things a different way?


Try to use:
a=`echo $(ls | wc -c)` #no space after varaible name "a" nad "=" sign.
echo $a

i tried a=`ls | wc -c` and it's working fine for me!

But I got "filename: a: command not found" error message when i put space after "a" (variable name)

is this the problem with your script?