[GRASSLIST:3799] Re: another scripting question

Glynn Clements glynn.clements at virgin.net
Thu Jul 1 18:40:57 EDT 2004


Kirk R. Wythers wrote:

> I'm looking for a little more scripting advice as I put together a 
> couple of tools to handle an  image rectifying job. I think I have most 
> of what I need, but I'm stuck on what I perceive as one of the first 
> steps.
> 
> Both scripts need to run through all files in a particular mapset.
> 
> Therefor my first question is how to step through each map within the 
> current mapset, so that the same procedure can be applied to every one 
> of them? Most of the examples I've found use the map name as an 
> argument specified on the command line.
> 
> Any tips?

1. List the "cell" directory.

eval `g.gisenv`
ls "$GISDBASE/$LOCATION_NAME/$MAPSET/cell" | while read map ; do
	... $map
done

2. Parse the output of "g.list rast".

Option 1 is likely to be the easiest; the output of g.list isn't
exactly easy to parse.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list