dwww Home | Manual pages | Find package

g.tempfile(1grass)          GRASS GIS User's Manual         g.tempfile(1grass)

NAME
       g.tempfile  - Creates a temporary file and prints it’s file name.

KEYWORDS
       general, support, scripts

SYNOPSIS
       g.tempfile
       g.tempfile --help
       g.tempfile [-d] pid=integer  [--help]  [--verbose]  [--quiet]  [--ui]

   Flags:
       -d
           Dry run - don’t create a file, just prints it’s file name

       --help
           Print usage summary

       --verbose
           Verbose module output

       --quiet
           Quiet module output

       --ui
           Force launching GUI dialog

   Parameters:
       pid=integer [required]
           Process id to use when naming the tempfile

DESCRIPTION
       g.tempfile  is designed for shell scripts that need to use large tempo-
       rary files.  GRASS provides a mechanism for temporary files  that  does
       not  depend on /tmp. GRASS temporary files are created in the data base
       with the assumption that there will be enough space under the data base
       for  large files.  GRASS periodically removes temporary files that have
       been left behind by programs that failed to remove them  before  termi-
       nating.

       g.tempfile  creates an unique file and prints the name. The user is re-
       quired to provide a process-id which will be used as part of  the  name
       of  the  file.  Most Unix shells provide a way to get the process id of
       the current shell.  For /bin/sh and /bin/csh this is $$.  It is  recom-
       mended that $$ be specified as the process-id for g.tempfile.

EXAMPLE
       For /bin/sh scripts the following syntax should be used:
       temp1=`g.tempfile pid=$$`
       temp2=`g.tempfile pid=$$`
       For /bin/csh scripts, the following can be used:
       set temp1=`g.tempfile pid=$$`
       set temp2=`g.tempfile pid=$$`

NOTES
       Each  call  to  g.tempfile creates a different (i.e. unique) name.  Al-
       though GRASS does eventually get around to removing tempfiles that have
       been  left  behind,  the  programmer should make every effort to remove
       these files. They often get large and take up disk space. If you  write
       /bin/sh  scripts,  learn  to use the /bin/sh trap command. If you write
       /bin/csh scripts, learn to use the /bin/csh onintr command.

AUTHOR
       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory

SOURCE CODE
       Available at: g.tempfile source code (history)

       Accessed: unknown

       Main index | General index | Topics index | Keywords index |  Graphical
       index | Full index

       © 2003-2022 GRASS Development Team, GRASS GIS 7.8.7 Reference Manual

GRASS 7.8.7                                                 g.tempfile(1grass)

Generated by dwww version 1.14 on Fri Jan 24 09:31:10 CET 2025.