mktemp

Create a unique temporary file or directory

Syntax:

mktemp [-V] | [-dqtu] [-p prefix] [template]

Runs on:

QNX Neutrino

Options:

-d
Create a directory instead of a file.
-p prefix
Use the specified directory as a prefix when creating the temporary file. This prefix is overridden if the TMPDIR environment variable is set. The option implies -t.
-q
Don't print anything, even error messages.
-t
Create the temporary file in a temporary directory. The process for selecting a temporary directory is as follows:
  1. the TMPDIR environment variable, if set
  2. the directory specified with the -p option.
  3. /tmp

In this mode, the template (if specified) should be a directory component (as opposed to a full path) and thus shouldn't contain any forward slashes.

-u
Unlink the temporary file before exiting.
Note: This behavior is considered unsafe, and its use isn't encouraged.
-V
Print the version of the utility and then exit.

Description:

The mktemp utility creates a unique temporary file or directory. The template can be any filename with at least six X characters appended to it. The Xs are replaced with a unique combination of alphanumeric characters. If you don't specify a template, then mktemp uses tmp.XXXXXXXXXX, and the -t option is implied.

If mktemp successfully generates a unique name, it then opens the file or directory with read and write permission for the owner (unless you specify the -u option).

Exit status:

0
The file or directory was successfully created.
1
An error occurred.

Contributing author:

The mktemp utility was developed by Todd C. Miller; see https://www.mktemp.org/mktemp/mktemp.html.