Subject: Re: bug#9449: Bug report on 'wc' : characters count adds one character

From: Davide Brini <[email-masked]>
Date: Tue, 6 Sep 2011 16:22:00 +0200

On Tue, 6 Sep 2011 15:49:24 +0200, "Laurent TARRISSE"
<[email-masked]> wrote:

> Hi,
> 
> Documentation on 'wc' says:
> ----------------------------------------------
> wc -m, --chars
>               print the character counts
> 
> ----------------------------------------------
> 
> But here follows the output I get:
> 
> >echo toto | wc --chars
> 5
> >echo five | wc --chars
> 5
> >echo four | wc --chars
> 5
> >echo f  | wc --chars
> 2
> >echo "" | wc --chars
> 1
> 
> Why does 'wc' add one character ?

wc isn't adding anything. If you do "echo toto" you're sending five
characters to the pipe. Try this:

echo toto | od -c

-- 
D.