mktemp var [-p dir] [-d] [-t] [template]
mktemp_bash var [-p dir] [-d] [-t] [template]
mktemp_init_tmpdir parent_dir
mktemp_rm_tmpdir
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.
-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
_mktemp_TMPDIR
The value set by this variable is used as value for TMPDIR for mktemp call we dont set TMPDIR ourseleves but use this variable.
mktemp_bash() refers to this variable directly and mktemp calls the command mktemp with value of TMPDIR set to the value of thei variable in the command execution environment. Therefore, if you are using external mktemp do not make TMPDIR readonly.
This variable can be initailized by calling mktemp_init_tmpdir with a parent_dir argument and can be removed by calling mktemp_rm_tmpdir() in the end. Do not use this variable directly.
ZENPAKT_USE_MKTEMP
If value is zero, mktemp_bash is used instead.