creating a script

Darrell McCauley mccauley at ecn.purdue.edu
Thu Dec 30 00:39:38 EST 1993


Greg Koerper (greg at dubious.cor2.epa.gov) writes on 29 Dec 93:
>> I have a series raster files (cell files) located in /PERMANENT/cell.  I want
>> to convert them into ASCII format using r.out.ascii command.  I am trying to
>> write a script like a .sh command, but grass does not recognize it.  Can anyone
>> tell me how I create a .sh program in grass.
                         ^^^^

>You'll be better off using a foreach command, for example:

here is a minimal beginning:

#!/bin/sh
files=`g.list t=rast m=PERMANENT | egrep -v '^----' | egrep -v '^raster files'`
for i in $files; do
  echo processing $i
done

see the programming manual (chapter 25) and $GISBASE/scripts
for hints.

BTW, it sure would be a nice addition to the g.list command
if we could have a flag that would rid us of the extraneous
information that I had to grep out... or have I missed something.

--Darrell



More information about the grass-user mailing list