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}

From https://stackoverflow.com/a/41620630/836748


No comments.