mktemp

SYNOPSIS

mktemp var [-p dir] [-d] [-t] [template]

mktemp_bash var [-p dir] [-d] [-t] [template]

mktemp_init_tmpdir parent_dir

mktemp_rm_tmpdir

DESCRIPTION

mktemp() creates a temporary file using GNU mktemp if available or else using bash $RANDOM sequences by calling mktemp_bash.The template may be any filename with six X appended to it.If no template is specified a default of tmp.XXXXXX is used and -t is implied.

By default it creates directories and files in current directory if the given template doesnot contain a directory path.If -t is used or if the template is not given -t is implied, the directory for creating temporary files is chosen as follows:

With -t and -p, template used must not contain a directory path.

As a general rule, we always create a temporary directory and create temporary files within and clean the directories up on exit.

If a command mktemp is found in PATH, GNU mktemp is assumed.

OPTIONS

-p the parent directory, implies -t
-d create a directory instead
-t create file under a temporary directory

Note: the -q option is used by default with mktemp utility

RETURN STATUS

ENVIRONMENT