Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm looking to install the package for tempfile but am not finding it? possibly use mktemp but I'm not sure if there is a difference in behaviour besides a dot notation in the temp name?

$ tempfile # /tmp/file1wJzkz
$ mktemp   # /tmp/tmp.IY8k24NayM
share|improve this question

1 Answer 1

up vote 3 down vote accepted

The name generated by mktemp can be modified to have no dots. For example:

mktemp XXXXX => 8U5yc
mktemp /tmp/XXXXX => /tmp/tsjoG

From man mktemp:

DESCRIPTION
   Create a temporary file or directory, safely, and print its name.  TEM‐
   PLATE must contain at least 3 consecutive 'X's in last  component.   If
   TEMPLATE is not specified, use tmp.XXXXXXXXXX, and --tmpdir is implied.
   Files are created u+rw, and directories  u+rwx,  minus  umask  restric‐
   tions.

In any case, forget about tempfile, just use mktemp. The following is from man tempfile on my Debian (emphasis mine):

BUGS

Exclusive creation is not guaranteed when creating files on NFS partitions. tempfile cannot make temporary directories. tempfile is deprecated; you should use mktemp(1) instead.

share|improve this answer
    
+1 and accepted, thanks for the prompt answer –  ehime Nov 15 '13 at 17:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.