The behavior described in the question is related to the design of sudo .
$ sudo cat <(echo "installed.txt") cat: /dev/fd/63: Bad file descriptor
The error occurs because sudo has a default behavior that closes file descriptors, with the exception of standard input, output, and error. As described on the manual page:
By default, sudo closes all open file descriptors other than standard input, standard output, and standard error when executing a command.
You can override this behavior with the -C (or --close-from ) option to specify the file descriptor number below which files should not be closed. However, the use of this option must be authorized by the administrator: to /etc/sudoers
The following should be added:
Defaults closefrom_override
In this case, the command will work if -C used:
$ sudo -C64 cat <(echo "installed.txt") installed.txt
(the number 64 was indicated here, since it was greater than 63 in the error message).
starfry
source share