Posts for the month of December 2020

Temporary File Descriptors (FDs) in Bash

Found this useful the other day when I needed an FD and not a file name… in my example, I was testing some python code where C++ was doing the heavy lifting and was going to pass an open FD to python.

exec {tempo}<> scratchfile
echo ${tempo}
ls -halF /proc/self/fd
command --fd=${tempo}