creating a script

Greg Koerper greg at dubious.cor2.epa.gov
Wed Dec 29 19:57:16 EST 1993


> 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:

foreach i (`ls`)
? r.out.ascii $i > DIR/$i.asc
? end

The above would create ascii output of all files in the current directory.
(So preceeeding this, you would have made /PERMANENT/cell your current
working directory).  If you want to test the effect before committing yourself,
substitute echo $i for the r.out.ascii line above.  You can then see the list
that will be processed by the foreach.  You may wish to use `ls xxx*` in 
place of `ls` if you only want to transform some subset of the directory files.



More information about the grass-user mailing list