On Wed, Dec 11, 2024, at 11:00 PM, Christoph Anton Mitterer via austin-group-l 
at The Open Group wrote:
> I kinda lack any specific word which says that e.g.
>   file='&1'
>   ls does-not-exist 2>"$file" | grep 'No such file or directory'
> cannot be tricked into duplicating the fd, but always has to write to
> the file `&1`.

The ">&" operator is a token (see Section 2.10.2), so it has to be
recognized during tokenization (see Section 2.3), which necessarily
occurs before any parameter expansion.


> it doesn't seem to me that this
> follows strictly from the standard, as 2.7 says nothing about quoting
> of word

I'm not sure what this has to do with anything.


> and 2.7.5/2.7.6 neither say that the & must be unquoted.

Section 2.7 already says

        If any part of redir-op is quoted, no redirection expression
        is recognized.

The '&' is part of the "<&" and ">&" operators and so must remain
unquoted.  There is no need for 2.7.5 and 2.7.6 to reiterate this.


> Would people agree to that (in which case I'd open it as a ticket), or
> is it felt, that it's already strictly(!) clear from the current
> wording.

I don't think any changes are necessary.


-- 
vq

  • may the curr... Christoph Anton Mitterer via austin-group-l at The Open Group
    • Re: may... Lawrence Velázquez via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group

Reply via email to