POSIX conformance of ls -l -1
mikolas.janota at gmail.com
Sun Mar 22 15:01:47 PDT 2009
On Sun, Mar 22, 2009 at 4:32 PM, David Schultz <das at freebsd.org> wrote:
> On Sun, Mar 22, 2009, Mikoláš Janota wrote:
>> For the command ls, the POSIX standard, says that "When -l (ell) is
>> specified, -1 (one) shall be assumed."
>> In the FreeBSD implementation, however, -1 and -l override one
>> another. I can't see how this could be POSIX compliant.
>> I'm on Mac OS X which I believe is using FreeBSD port and the man page
>> claims POSIX compliance. Where can I find more information about this?
> Perhaps it's a bug. Comments in the source seem to indicate that
> it was done this way on purpose, though. If you have `ls' aliased
> to `ls -laG', for example, you can still use `ls -1' on the command
> line to force the single-line output (as if the options were `ls -aG'.)
> I'm not sure what we ought to do about it.
I think the problem is that -1 is interpreted sometimes as
"single-column" and sometimes as "one-per-line". The gnu
implementation of ls follows the POSIX standard and ls -l -1 is the
same as ls -l, but if you write --format=long --format=single-column,
long is overriden. Even though --format=single-column and -1 should be
More information about the freebsd-standards