mktemp -创建一个临时文件或目录

语法:
       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

你可能感兴趣的:(contain,specified,created)