In Bash, how to find the lowest-numbered unused file descriptor?

后端 未结 6 1762
梦毁少年i
梦毁少年i 2021-01-30 16:45

In a Bash-script, is it possible to open a file on \"the lowest-numbered file descriptor not yet in use\"?

I have looked around for how to do this, but it seems that Bas

6条回答
  •  粉色の甜心
    2021-01-30 16:59

    If it is on Linux, you can always read the /proc/self/fd/ directory to find out the used file descriptors.

提交回复
热议问题