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

Re: POSIX and the "&>" operator



On 2009-02-06 14:50:29 -0800, Bart Schaefer wrote:
> The following is part of an exchange on the austin-group mailing list.
> The assertion is that "foo&>bar" has a well-defined semantics in POSIX
> sh and therefore the bash extension (which zsh adopted) to make "&>" a
> synonym for "2>&1 >" is in violation of POSIX compliance.

IMHO, this is not clear. I agree with David Korn when he says:

----------------------------------------------------------------------
The way the standard is written, the grammar lists operators
that are required.  It doesn't say whether implementations
can support operators that aren't listed.

In section 2.3, token recognition, the standard says:

2.      If the previous character was used as part of an operator
        and the current character is not quoted and can be used
        with the current characters to form an operator, it shall
        be used as part of that (operator) token.


If implementations are allowed to provide additional operators,
then this requires that conforming script leave a space after
every operator character.   This would mean that
        command &> file
is not conforming.
----------------------------------------------------------------------

On 2009-02-07 22:48:39 +0000, Peter Stephenson wrote:
> We really ought to have a POSIX emulation separate from sh.  I have a
> feeling we've discussed this before.

Yes, at least here:
  http://www.zsh.org/mla/workers/2007/msg00852.html
  http://www.zsh.org/mla/workers/2008/msg00342.html

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



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