bug-bash
[Top][All Lists]
Advanced

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

Re: bash manual page does not describe the redirection form "n>&-".


From: Eduardo A . Bustamante López
Subject: Re: bash manual page does not describe the redirection form "n>&-".
Date: Thu, 29 May 2014 14:38:35 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

> However, the last paragraph does not describe the form "n>&-" (which
> does close descriptor n).  Perhaps that is implied by "similarly", but
> it would be better to spell it out:
> 
>        is used similarly to duplicate output file descriptors.  If
>        word expands to one or more digits, the file descriptor denoted
>        by n is made to be a copy of that file descriptor.  If the
>        digits in word do not specify a file descriptor open for
>        output, a redirection error occurs.  If word expands to -,
>        file descriptor n is closed.  If n is not specified, the
>        standard output (file descriptor 1) is used.  As a special
>        case, if n is omitted, and word does not expand to one or more
>        digits, the standard output and standard error are redirected
>        as described previously.
Hmm, I'd recommend to always check the most recent bash version. I
don't have the most recent, but I already have this:

|   Duplicating File Descriptors
|       The redirection operator
|
|              [n]<&word
|
|       is  used  to  duplicate input file descriptors.  If word expands to one 
or more digits, the file descriptor denoted by n is
|       made to be a copy of that file descriptor.  If the digits in word do 
not specify a file descriptor open for input, a  redi‐
|       rection  error  occurs.   If  word  evaluates to -, file descriptor n 
is closed.  If n is not specified, the standard input
|       (file descriptor 0) is used.
|
|       The operator
|
|              [n]>&word
|
|       is used similarly to duplicate output file descriptors.  If n is not 
specified, the standard output (file descriptor 1)  is
|       used.   If the digits in word do not specify a file descriptor open for 
output, a redirection error occurs.  If word evalu‐
|       ates to -, file descriptor n is closed.  As a special case, if n is 
omitted, and word does not expand to one or more digits
|       or -, the standard output and standard error are redirected as 
described previously.

Note the "If word evaluates to -," in both cases. Also, I wouldn't be
that picky on "evaluate" vs "expand", because they can be used
interchangeable here.



reply via email to

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