How to keep an open file handle in a shell script on Linux?
<p>A trick some daemons use, is to open a newly created temp file-handle, remove it from the file system, then execute the file descriptor.</p>

<p>This can be done from C, but I was curious if this would be possible from a shell script?</p>

<hr>

<p>Example use-case for running a temporary binary:</p>

<ul>
<li>Compile the binary to a temp location.</li>
<li>Open its file-handle</li>
<li>Remove it from the file-system</li>
<li><code>exec</code> the file descriptor.</li>
</ul>

<p>This way <code>exec</code> takes over the process and we don't need to worry about cleaning up the temporary file.</p>