autoopts_back

mktemp - Make a Temporary File or Directory

Main
AutoGen
Pages

Home
Announce
FAQ
docs
XML Defs
testimonials
downloads

Automated
Options

AutoOpts
Comparison
Man example
Redistribute
Licensing
local use
using getopt

GCC's
Fixincludes

fixincludes

Automated
FSM

description
example
usagefsm

Addons
addon

Project GNU
Home Page

Automated
XDR

xdr project

i

``mktemp'' is a minor variation on the verson from OpenBSD. It is being released because I rely on the suffix behavior and I would like to encourage the BSD version to pick up that attribute. You can find mktemp here.


mktemp Make a Temporary File or Directory

Here is the AutoGen-erated usage text:

Usage: 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.

  -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 slash.
                        This option is implied if TEMPLATE does not end in X.
      --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

  -p DIR              use DIR as a prefix; implies -t [deprecated]
  -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

Report mktemp bugs to bug-coreutils@gnu.org
GNU coreutils home page: </software/coreutils/>
General help using GNU software: </gethelp/>
Report mktemp translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'mktemp invocation'

Man Page for mktemp

Here is its own generated man page:

NAME

       mktemp - Make a temporary file name

SYNOPSIS

       mktemp [-flag [value]]... [--opt-name [[=| ]value]]...
               [ <file-pat> ]

       Makes  a  name  suitable for use as the path name for a temporary file.
       If successful, this program will create the output file (or directory).

DESCRIPTION

       This manual page briefly documents the mktemp  command.   This  program
       will  create  a  new empty file according to a default or provided file
       name pattern.  Unlike the now well-known BSD variation, by default this
       program  will  create  files  and  directories in temporary directories
       instead of the current directory.

       Parts of the name may be specified in <file-pat>, or with command  line
       options.  These differ as follows:

       The base option cannot specify the six (or more) substitution X-es.

       The file-pat argument specifies the suffix by embedding six X-es in the
       name.

       You may not have both a base option and a file-pat argument.

       If the file-pat specifies either a directory or a suffix, then you must
       not provide the corresponding option.

       If  successful, the program will exit with a zero status code and print
       the name of the created file to stdout (unless --quiet has been  speci-
       fied).

OPTIONS

       -p temp-dir, --tmpdir=temp-dir
              temp  directory  for  the  file.  This option is a member of the
              tmpdir class of options.

              If this option is not provided, mktemp will use the  environment
              variable  TMPDIR to find a suitable directory.  If these are not
              available, it will fall back to ~/tmp  or  /tmp.   A  <file-pat>
              command line argument containing a directory component will con-
              flict with this option.

       -b base-name, --base=base-name
              base of file name.

              By default, the file will be named, ".tmp-XXXXXX".  This  option
              will  replace  the ".tmp-" part and prohibit the <file-pat> com-
              mand line argument.

       -s sfx, --suffix=sfx
              file name suffix.

              By default, there is no suffix for the file.  This  option  will
              cause  the  resulting file to be renamed (if possible) with this
              suffix.  If the file cannot be renamed  (because,  for  example,
              there  is  already  a  file by that name), then the name printed
              will not have this suffix.  (The ``mkstemp(3C)''  function  upon
              which this utility relies requires that the final 6 or mor char-
              acters be 'X'.)

              If the suffix begins with the characters ''.'', ''-'' or will be
              the  complete  suffix.   Otherwise,  a  period  (''.'')  will be
              inserted between the generated name and this suffix.

       -t, --deprecated-tmpdir
              place file in temp directory.  This option is a  member  of  the
              tmpdir class of options.

              Generate a path rooted in a temporary directory.  This directory
              is chosen as follows:

              If the user's TMPDIR environment variable is set, the  directory
              contained therein is used.

              Otherwise, if the -p flag was given the specified direc- tory is
              used.

              If none of the above apply, /tmp is used.  @end itemize

              In this mode, the template (if specified) should be a  directory
              component  (as  opposed to a full path) and thus should not con-
              tain any forward slashes.

       -c, --create
              create file (default).  This option may not be preset with envi-
              ronment  variables or in initialization (rc) files.  This option
              is a member of the create class of options.

              mkstemp(3) will create the file with the name it comes  up  with
              anyway, so this is the default action.

       -u, --dry-run
              Do  not  create  anything.   This  option may not be preset with
              environment variables or in  initialization  (rc)  files.   This
              option is a member of the create class of options.

              If you do not wish to have the file created, specify this option
              and it will be removed.  This is also considered "unsafe"  mode.
              The file/directory may get created, but is immediately removed.

       -d, --directory
              temporary  directory.   This option may not be preset with envi-
              ronment variables or in initialization (rc) files.  This  option
              is a member of the create class of options.

              Alternatively,  you  can  have  a directory created instead of a
              file.  In that event, specify this option.

   The following options are commonly used and are provided and supported
       by AutoOpts:"

       -V, --verbose
              run program with progress info.

              Specifying this option will cause the program to display lots of
              progress  information.  You will be able to see that the program
              is working and it may help you debug your use of the tool.

       -q, --quiet
              run without unnecessary output.

              Specifying  this  option  will  cause  the  program  to  disable
              progress information.

       -?, --help
              Display usage information and exit.

       -!, --more-help
              Extended usage information passed thru pager.

       -> [rcfile], --save-opts[=rcfile]
              Save  the  option state to rcfile.  The default is the last con-
              figuration file listed in the OPTION PRESETS section, below.

       -< rcfile, --load-opts=rcfile, --no-load-opts
              Load options from rcfile.  The no-load-opts  form  will  disable
              the  loading of earlier RC/INI files.  --no-load-opts is handled
              early, out of order.

       -v [{v|c|n}], --version[={v|c|n}]
              Output version of program and exit.  The default mode is `v',  a
              simple  version.   The `c' mode will print copyright information
              and `n' will print the full copyright notice.

OPTION PRESETS

       Any option that is not marked as not presettable may be preset by load-
       ing  values from configuration ("RC" or ".INI") file(s) and values from
       environment variables named:
         MKTEMP_<option-name> or MKTEMP
       The environmental presets take precedence (are  processed  later  than)
       the  configuration files.  The homerc file is "$HOME", unless that is a
       directory.  In that case, the file ".mktemprc" is searched  for  within
       that directory.

AUTHOR

       Bruce Korb
       Please send bug reports to:  autogen-user@lists.sf.net

       Released under the Free BSD License.

       This manual page was AutoGen-erated from the mktemp option definitions.

( 2.1) 2009-08-02 MKTEMP(1)

This man page was converted to HTML by man2html

top  Viewable With Any Browser  Valid XHTML 1.0!


AutoGen, AutoOpts, columns, getdefs, AutoFSM, AutoXDR and these web pages copyright (c) 1999-2012 Bruce Korb, all rights reserved.

Return to GNU's home page.

Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.

Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

This article, Copyright © 2000-2002 by Bruce Korb

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Last modified: Sat Aug 30 11:01:49 PDT 2014