1g.tempfile(1)                 Grass User's Manual                g.tempfile(1)
2
3
4

NAME

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

KEYWORDS

9       general, support, scripts
10

SYNOPSIS

12       g.tempfile
13       g.tempfile --help
14       g.tempfile [-d] pid=integer  [--help]  [--verbose]  [--quiet]  [--ui]
15
16   Flags:
17       -d
18           Dry run - don’t create a file, just prints it’s file name
19
20       --help
21           Print usage summary
22
23       --verbose
24           Verbose module output
25
26       --quiet
27           Quiet module output
28
29       --ui
30           Force launching GUI dialog
31
32   Parameters:
33       pid=integer [required]
34           Process id to use when naming the tempfile
35

DESCRIPTION

37       g.tempfile  is designed for shell scripts that need to use large tempo‐
38       rary files.  GRASS provides a mechanism for temporary files  that  does
39       not  depend on /tmp. GRASS temporary files are created in the data base
40       with the assumption that there will be enough space under the data base
41       for  large files.  GRASS periodically removes temporary files that have
42       been left behind by programs that failed to remove them  before  termi‐
43       nating.
44
45       g.tempfile  creates  an  unique  file  and prints the name. The user is
46       required to provide a process-id which will be used as part of the name
47       of  the  file.  Most Unix shells provide a way to get the process id of
48       the current shell.  For /bin/sh and /bin/csh this is $$.  It is  recom‐
49       mended that $$ be specified as the process-id for g.tempfile.
50

EXAMPLE

52       For /bin/sh scripts the following syntax should be used:
53       temp1=`g.tempfile pid=$$`
54       temp2=`g.tempfile pid=$$`
55       For /bin/csh scripts, the following can be used:
56       set temp1=`g.tempfile pid=$$`
57       set temp2=`g.tempfile pid=$$`
58

NOTES

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

AUTHOR

68       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
69

SOURCE CODE

71       Available at: g.tempfile source code (history)
72
73       Main index | General index | Topics index | Keywords index |  Graphical
74       index | Full index
75
76       © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
77
78
79
80GRASS 7.8.2                                                      g.tempfile(1)
Impressum