Hi Listers,
fiddling about r.fillnulls I came across a number of temporary rasters and
vectors. After finding that g.tempfile provides a secure way to handle
text-/image files or even directories, I am wondering if there is an agreed
upon way to handle temporary rasters/vectors in scripts?
It seems to me that (at the moment) the usual way to write temporary
raster/vector is to use something along the line of
TMP1=r_fillnulls_$$
and building up the next from there like
out=$TMP1.buf
A naming scheme like that enables a kind of general exitprocedure like:
exitprocedure()
{
echo "cleaning up ..."
#deletes all TMP-files from this process
g.remove rast=$(g.mlist type=rast pattern=$TMP1* | tr "\n" ",") > /dev/null
g.remove vect=$(g.mlist type=vect pattern=$VECTTMP | tr "\n" ",") > /dev/null
exit 1
}
But, does one have to care for the odd chance that a user might have named
his rasters as strange as r_fillnulls_(number identical to the used PID)?
Or is there a secure way to write and delete rasters in grass scripts?
cheers,
robert