ehi*_*ime 3 command-line centos tmp
我正在寻找安装包,tempfile
但没有找到它?可能会使用,mktemp
但我不确定除了临时名称中的点符号外,行为是否有所不同?
$ tempfile # /tmp/file1wJzkz
$ mktemp # /tmp/tmp.IY8k24NayM
Run Code Online (Sandbox Code Playgroud)
生成的名称mktemp
可以修改为没有点。例如:
mktemp XXXXX => 8U5yc
mktemp /tmp/XXXXX => /tmp/tsjoG
Run Code Online (Sandbox Code Playgroud)
从人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.
Run Code Online (Sandbox Code Playgroud)
无论如何,忘记tempfile
,只需使用mktemp
。以下内容来自man tempfile
我的 Debian(重点是我的):
错误
在 NFS 分区上创建文件时,不保证独占创建。tempfile 不能创建临时目录。 不推荐使用临时文件;您应该改用 mktemp(1)。