On Thu, Aug 11, 2016 at 07:52:51AM -0400, Chet Ramey wrote:
> On 8/10/16 5:38 PM, Dmitry Goncharov wrote:
> 
> >> > does "If any file argument to one of the primaries is of the form
> > 
> >> > /dev/fd/n, then file descriptor n is checked.".
> > 
> > 
> >> It seems like a documentation error.
> > 
> > What should the man page say instead?
> 
> Probably something close to what the current text about using /dev/fd in
> redirections says, maybe:

Do you mean current text in process substitution?

The current text in redirection says
"/dev/fd/fd
    If fd is a valid integer, file descriptor fd is duplicated."

There is asymmetry
>/dev/fd/6 redirects to fd 6, while
test -p /dev/fd/6 tests file "/dev/fd/6".


> 
> \fBBash\fP handles filenames of the form \fI/dev/fd\fP specially when they
> are used as arguments to unary operators.
> If the operating system on which \fBbash\fP is running provides these
> special files, bash will use them; otherwise if
> any \fIfile\fP argument to one of the primaries is of the form
> \fI/dev/fd/n\fP, then file descriptor \fIn\fP is checked.

With this new contract how can the user write portable bash code which tests if
a fd refers to a pipe?

regards, Dmitry

Reply via email to