[GRASS-user] Temporary files in GRASS Script

2010-01-05 Thread Nikos Dumakis
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
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Temporary files in GRASS Script

2010-01-05 Thread Glynn Clements

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 gl...@gclements.plus.com
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user