3

Why does echo "a" | wc -m echo 2? Other variations in which I try to reduce the number of spaces yield the same result.

1
6

Because wc counts the newline \n too.

echo adds a newline character to end of the output, unless invoked with -n option.

1
  • 1
    Just realised this -_- – y_wc Mar 21 '19 at 16:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.