word count wc

could someone explain this please.

echo aaaa|wc -c
5
echo aaaa|wc -m
5

But I'd expect the count to be 4

Its SunOS 5.8

Thanks in Advance.

Interesting. Does the same thing in Solaris 2.6, and 9, and Fedora too.

This is starting to be a faq...

Finding out the length of a string held within a variable
wc -c
length of the string

Thanks for your input!

Pretty simple but made complex.
wc man page should get an update.

Cheers!

Instead of man wc, check out

info wc

contains those information.

Vino

I belive is counting the end Character. If you do:

echo | wc -c
1

echo| wc -c
1