[GRASSLIST:3801] Re: another scripting question
Markus Neteler
neteler at itc.it
Fri Jul 2 03:07:58 EDT 2004
On Thu, Jul 01, 2004 at 11:40:57PM +0100, Glynn Clements wrote:
>
> 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.
3. option
Use g.mlist, which is easy to parse.
Markus
More information about the grass-user
mailing list