mktemp(1)

mktemp(1)

NAME

mktemp - make a name for a temporary ®le

SYNOPSIS

mktemp [-c][-ddirectory_name ] [-ppre®x ]

DESCRIPTION

mktemp makes a name that is suitable for use as the pathname of a temporary ®le, and writes that name to the standard output. The name is chosen such that it does not duplicate the name of an existing ®le. If the -coption is speci®ed, a zero-length ®le is created with the generated name.

The name generated by mktemp is the concatenation of a directory name, a slash ( / ), the value of the LOGNAME environment variable truncated to {NAME_MAX} − 6 characters, and the process ID of the invoking process.

The directory name is chosen as follows:

1.If the -doption is speci®ed, directory_name is used.

2.Otherwise, if the TMPDIR environment variable is set and a string that would yield a unique name can be obtained by using the value of that variable as a directory name, this value is used.

3.Otherwise, if a string that would yield a unique name can be obtained using /tmp as the direc- tory, /tmp is used.

4.Otherwise, . (current directory) is used.

If the -poption is speci®ed, pre®x is used instead of the value of the LOGNAME environment variable for name generation.

RETURN VALUE

mktemp returns zero on successful completion and non-zero if syntax, ®le access, or ®le creation errors were encountered or a unique pathname could not be generated.

SEE ALSO mktemp(3C), umask(1).

m

HP-UX Release 11i: December 2000

− 1 −

Section 1539