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

NAME

6       g.tempfile  - Creates a temporary file and prints the file name.
7

KEYWORDS

9       general
10

SYNOPSIS

12       g.tempfile
13       g.tempfile help
14       g.tempfile pid=integer
15
16   Parameters:
17       pid=integer
18           Process id to use when naming the tempfile
19

DESCRIPTION

21       g.tempfile  is designed for shell scripts that need to use large tempo‐
22       rary files.  GRASS provides a mechanism for temporary files  that  does
23       not  depend on /tmp. GRASS temporary files are created in the data base
24       with the assumption that there will be enough space under the data base
25       for  large files.  GRASS periodically removes temporary files that have
26       been left behind by programs that failed to remove them  before  termi‐
27       nating.
28
29       g.tempfile  creates  an  unique  file  and prints the name. The user is
30       required to provide a process-id which will be used as part of the name
31       of  the  file.  Most Unix shells provide a way to get the process id of
32       the current shell.  For /bin/sh and /bin/csh this is $$.  It is  recom‐
33       mended that $$ be specified as the process-id for g.tempfile.
34

EXAMPLE

36       For /bin/sh scripts the following syntax should be used:
37       temp1=`g.tempfile pid=$$`
38       temp2=`g.tempfile pid=$$`
39        For /bin/csh scripts, the following can be used:
40       set temp1=`g.tempfile pid=$$`
41       set temp2=`g.tempfile pid=$$`
42
43

NOTES

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

AUTHOR

53       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
54
55       Last changed: $Date: 2005/12/07 13:31:15 $
56
57       Full index
58
59
60
61GRASS 6.2.2                                                      g.tempfile(1)
Impressum