[Bug 249522] wc(1) prints leading spaces before the count, which appears to not be POSIX-compliant
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Sep 22 11:01:26 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249522
Bug ID: 249522
Summary: wc(1) prints leading spaces before the count, which
appears to not be POSIX-compliant
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Keywords: standards
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: 0mp at FreeBSD.org
This document[1] suggests that there should be no leading whitespace characters
printed before the count. Also, this is how GNU wc behaves, e.g.:
```
$ echo 123 | wc -c
4
```
The FreeBSD wc(1) works like this, however:
```
$ echo 123 | wc -c
4
```
Our behaviour tends to be the source of bugs when people try to do things like
this:
```
if [ "$(wc -l file)" -gt 10 ]; then ...
```
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/wc.html
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list