Temporary File Name

For creating temporary files with unique names, there’s the hard way and then there’s the easy way.

I would have left a comment about this on a little stupid blog, but the comments were closed, so I’m making this entry in the hopes that Google’ll pick it up and show it to someone like I was a minute ago, forgetting the name of mktemp.

Comments

2 responses to “Temporary File Name”

  1. Serge Avatar
    Serge

    Keep in mind that mktemp, although old, its not always available on all *nix systems. One thing that a little stupid blog failed to mention is that if you use Bash as your shell, you will always have those environment variables available to you unless you unset them. Meaning, the code will be portable to other *nix systems that have Bash installed. Personally, I prefer mktemp but its nice to have a portable option as well.

  2. Jani Avatar

    Ah, right. Thanks for the comment, I didn’t come to think of that.