Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: grammar triviality with '&&'



On 2015-03-02 20:43:27 -0800, Kurtis Rader wrote:
> On Mon, Mar 2, 2015 at 8:15 PM, ZyX <kp-pav@xxxxxxxxx> wrote:
> >
> > I do not think this is a mistake. And I found at least two differences:
> >
> > 1. `command test --help` returns zero, `command \[ --help` displays help.
> > 2. `[` requires `]` (unless it received `--help` or `--version`), no
> > matter what name it is called with, `test` requires not.
> >
> > Note that coreutils ebuild does *not* contain any references to `test` or
> > `[`, patches as well do not (except when Makefile is patched not to
> > regenerate man pages). This means that this difference is created by GNU
> > developers, *not* by distro maintainers.
> >
> 
> Ugh! I can confirm your observations using my Ubuntu 14.04 server. Yet on
> Mac OS X Yosemite the two names are linked to the same binary. Mac OS X
> exhibits the traditional behavior. I have no idea why GNU based distros
> have the two names linked to slightly differently behaving binaries.

Having different behaviors is required by POSIX:

  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

However you do not need different binaries to get different
behaviors: the binary could look at argv[0] to know how to
behave.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author