語法:
mktemp [OPTION]... [TEMPLATE]
Create a temporary file or directory, safely, and print its name.
TEMPLATE 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 restrictions.
安全的創建臨時文件或目錄並輸出創建的文件名.
如果需要指定最後部分的[TEMPLATE],它必須包含至少3個連續的X字符
如果沒有指定[TEMPLATE] ,則默認使用tmp.XXXXXXXXXX (連續10個X字符)
創建的臨時文件和目錄默認在/tmp下
通過mktemp命令創建的臨時文件的默認權限爲u+rw,臨時目錄權限爲u+rwx
-d, --directory
create a directory, not a file
//創建一個目錄
-u, --dry-run
do not create anything; merely print a name (unsafe)
//僅打印文件名不創建任何文件或目錄
-q, --quiet
suppress diagnostics about file/dir-creation failure
--suffix=SUFF
append SUFF to TEMPLATE; SUFF must not contain a slash. This
option is implied if TEMPLATE does not end in X
//指定TEMPLATE的後綴名,不能包含斜線.
//也可以直接加上除X字符以外的任意字符後綴作爲TEMPLATE,兩者等效
-p DIR, --tmpdir[=DIR]
interpret TEMPLATE relative to DIR; if DIR is not specified, use
$TMPDIR if set, else /tmp. With this option, TEMPLATE must not
be an absolute name; unlike with -t, TEMPLATE may contain
slashes, but mktemp creates only the final component
//指定要創建的臨時文件的路徑,不指定則爲/tmp.
//TEMPLATE可以包含路徑.但指定了DIR後,TEMPLATE不能再包含絕對路徑
-t interpret TEMPLATE as a single file name component, relative to
a directory: $TMPDIR, if set; else the directory specified via
-p; else /tmp [deprecated] //官方已不贊成使用
--help display this help and exit
--version
output version information and exit