What's the difference between tempfile and mktemp?

前端 未结 3 1488
我在风中等你
我在风中等你 2021-02-03 21:38

Most systems I\'ve encountered have both tempfile(1) and mktemp(1). There are syntactic differences, and mktemp can also create directorie

3条回答
  •  面向向阳花
    2021-02-03 22:24

    I suspect there's some interesting Unix lore behind this ...

    The history of mktemp can be traced to OpenBSD 2.1. However, it became a part of GNU coreutils much later. This post announced the inclusion of mktemp for coreutils.

    Until then, tempfile was being used by a number of programs. There was also a proposal to make tempfile a wrapper around mktemp, which was rejected to discourage use of tempfile.

    However, the following was added to tempfile manual:

    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.

提交回复
热议问题