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


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


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


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


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

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


       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.


       Original  tempname  routine  Copyright  1991-2001, 2006-2007, 2009 Free
       Software Foundation,  Inc.   Derived  tempname  program  Copyright  (C)
       2004-2018 by Brian Lindholm.

       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-
       Public License for more details.

littleutils                       2018 Jun 03                      tempname(1)

littleutils 1.0.40 - Generated Tue Mar 26 16:24:49 CDT 2019
© 2000-2020
Individual documents may contain additional copyright information.