Notes
/proc/[number]/fd
This is a subdirectory containing one entry for each file which the process
has open, named by its file descriptor, and which is a symbolic link to the
actual file. Thus, 0 is standard input, 1 standard output, 2 standard error,
etc.
In a multithreaded process, the contents of this directory are not available
if the main thread has already terminated (typically by calling
pthread_exit(3)).
Programs that will take a filename, but will not take the standard input, and
which write to a file, but will not send their output to standard output, can
be effectively foiled this way, assuming that -i is the flag designating an
input file and -o is the flag designating an output file:
foobar -i /proc/self/fd/0 -o /proc/self/fd/1 ...
Links