Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2020 11:01:25 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 249522] wc(1) prints leading spaces before the count, which appears to not be POSIX-compliant
Message-ID:  <bug-249522-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249522

            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@FreeBSD.org
          Reporter: 0mp@FreeBSD.org

This document[1] suggests that there should be no leading whitespace charac=
ters
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 l=
ike
this:

```
if [ "$(wc -l file)" -gt 10 ]; then ...
```

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/wc.html

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249522-227>