Dear Maintainer,
it is stated in manpage that duplicating RO file descriptor causes a
redirection error:
>>>
$ man 1 bash | grep -A17 'Duplicating File Descriptors$' | tail -n2
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 evaluates to -, file descriptor n is
<<<
but it does not:
>>>
$ ( set -e ; exec 3< /dev/null ; exec 4>&3 ; echo OK )
OK
<<<
an error would be to write to the RO file descriptor:
>>>
$ ( set -e ; exec 3< /dev/null ; exec 4>&3 ; echo >&4 ; echo OK )
bash: echo: write error: Bad file descriptor
<<<
it is not a redirection error, but another one; I have checked two other
shells: dash and ksh, — neither of them raises any redirection error, then I
guess it is a documentation bug, and this sentence can be safely removed:
>>>
If the digits in word do not specify a file descriptor open for output, a redirection error occurs.
<<<