this [answer](https://unix.stackexchange.com/questions/181937/how-create-a-temporary-file-in-shell-script/181938#181938) uses a nice trick to guarantee auto cleanup: ``` tmpfile=$(mktemp /tmp/abc-script.XXXXXX) exec 3>"$tmpfile" rm "$tmpfile" : ... echo foo >&3 ``` the cleanup would happen even if a crash happens (or, say, a `quit`): > When it gets closed (which the kernel does automatically when the process exits) the filesystem deletes the file the same trick could be used (as option!) in tempfile API
this answer uses a nice trick to guarantee auto cleanup:
the cleanup would happen even if a crash happens (or, say, a
quit):the same trick could be used (as option!) in tempfile API