manpagez: man pages & more
man tempname(1)
Home | html | info | man
tempname(1)                                                        tempname(1)




NAME

       tempname  -  create a unique temporary file, directory, or unused file-
       name for use by shell scripts


SYNOPSIS

       tempname [-c(reate_not)] [-d dirname] [-h(elp)]  [-n(o_random_portion)]
       [-q(uiet)]  [-s suffix] [-w(ildcard)] [-v(erbose)] [-D(irectory)] file-
       name_prefix


DESCRIPTION

       tempname creates a unique temporary file, directory, or unused filename
       for use by shell scripts with permissions 0600 or 0700, as appropriate.


OPTIONS

       -h     Print help and quit.

       -c     Do not create a temporary file or directory, but only print  the
              name.   It becomes the responsibility of the user to create this
              file.  Be warned.  Using this option is unsafe.

       -d     Specify the directory in which the temporary file will  be  cre-
              ated.  If this option is not specified, the program will attempt
              to locate a  writeable  temporary  directory  in  the  following
              order:  "$TMPDIR", "$TEMP", "$TMP", "/tmp", "/var/tmp", and ".".
              If no writeable directory can be found, the program will  abort.
              Directories  that  contain  one or more space characters will be
              skipped in this search.

       -n     Return the filename with no random portion attached.   Also,  no
              file  will  be  created as per the -c option.  This is typically
              used to provide a string against which  the  script  writer  can
              grep or something like that.

       -w     Return  the filename with a wildcard pattern instead of a random
              portion.  Also, no file will be created as per  the  -c  option.
              This  is  typically  used  to provide a string against which the
              script writer can perform wildcard searches.

       -D     Create a directory instead of a file.  The directory  will  have
              permissions 0700.  This option will override the -c option.

       -s suffix
              Attach the specified suffix to the filename.

       -v     Verbose  output.   The  program  will  complain about any search
              directories that it finds that are not writeable.

       -q     Quiet output.  The program will never complain about unwriteable
              directories,  even  when  the  user has specified an unwriteable
              directory using the -d option.


HISTORY

       This utility was originally intended as an alternative to the  tempfile
       program that is part of Debian's "debianutils" package.  The key reason
       for developing this new utility was the fact  that  some  programs  out
       there  insist  on  particular extensions in the filenames.  At the time
       tempname was written, the version of tempfile found in Debian  did  not
       provide   filename  extensions  on  the  temporary  files  it  created.
       Debian's tempfile utility subsequently had the --suffix  option  added,
       but  tempname  has  been preserved because of the usefulness of some of
       the other options.

       Another utility that provides similar  functionality  to  the  tempfile
       program  is mktemp by Todd Miller, which inspired the -D option, though
       no code was actually copied from mktemp.  And interestingly, GNU  core-
       utils added a mktemp utility with version 6.10 in 2008.

       The logic for safely creating a temporary file or directory was derived
       from the tempname routine in glibc-2.6.1 (and subsequent updated there-
       after).


COPYRIGHT

       Original tempname routine Copyright 1991-2020 Free Software Foundation,
       Inc.  Derived tempname program Copyright (C) 2004-2021 by  Brian  Lind-
       holm.

       This  program is free software; you can use it, redistribute it, and/or
       modify it under the terms of the GNU General  Public  License  as  pub-
       lished  by  the Free Software Foundation; either version 3, or (at your
       option) any later version.

       This program is distributed in the hope that it  will  be  useful,  but
       WITHOUT  ANY  WARRANTY;  without  even  the  implied  warranty  of MER-
       CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  General
       Public License for more details.



littleutils                       2021 Jan 15                      tempname(1)

littleutils 1.2.4 - Generated Wed Mar 31 18:17:15 CDT 2021
© manpagez.com 2000-2025
Individual documents may contain additional copyright information.