Greetings all
Following a few questions/emails from Glynn and Antonio regarding GRASS Scripting I have the following question:
What is the main difference between Temporary files creation mentioned in Glynn emails:
**tmp=tmp.myscript.$$**
**And the one used in r.centroid script:**
TMP=$$
TMPFILE=`g.tempfile pid=$TMP`
Thanks
Best regards,
Nikos
Nikos Dumakis wrote:
Following a few questions/emails from Glynn and Antonio regarding GRASS
Scripting I have the following question:
What is the main difference between Temporary files creation mentioned in
Glynn emails:
*tmp=tmp.myscript.$$*
*
*
*And the one used in r.centroid script:*
TMP=$$
TMPFILE=`g.tempfile pid=$TMP`
The former creates a name with a given format ($$ is the PID of the
shell process running the script).
g.tempfile creates a temporary file at:
<datbase>/<location>/<mapset>/.tmp/<hostname>/<pid>.<num>
where <num> is chosen such that the name is unique (for g.tempfile, it
will usually be zero; if a process calls G_tempfile() multiple times,
<num> will increment).
Use the former (or something like it) if you want a name for a
temporary map, region, etc. Use the latter if you need a file.
--
Glynn Clements <glynn@gclements.plus.com>