help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do `>& -` and `<& -` also work?


From: Chet Ramey
Subject: Re: Do `>& -` and `<& -` also work?
Date: Mon, 10 May 2021 15:25:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

On 5/10/21 1:56 PM, Peng Yu wrote:

The manual text that you quoted does not mention that there can be
spaces after `&` in `[n]>&word`. So I wouldn't consider that this is
clearly stated in the manual. As it is written, it doesn't seem to be
by design. It looks more like it is a consequence of the
implementation, which makes it just happens like that.

This is not correct.

I would think lexer return `[n]>&-` as a whole may make more sense.
Since `>&` has the meaning of dump stdout/err to a file, that file
could be named as "-".

That would not help anything.


The current lexer returns ">&" and "-" separately, making people have
to write `>& ./-` in order to write both stdout/err to a file named
`-`. This seems to be a worse syntax overall than treating `>&-` as a
whole, then `>& -` can just mean write stdout/err to the file "-".

Except it would be wrong, incompatible with other shells, and not POSIX
conformant.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]