[GRASSLIST:3498] Re: about writing a script program

Soil & Water Lab. swlab at cornell.edu
Thu Apr 11 10:18:29 EDT 2002


On Thursday 11 April 2002 02:13, Fengxian Fan wrote:
> Hi,
>
>    I used some commands in GRASS to analyse the data and got some
> resultant maps. Is it possible to write a script program including those
> commands I want to use, then execute the program to generate the resultant
> map automatically?

Yes. Just remember that scripting is OK for some simple tasks. For some more 
complex loop calculations, you may want to consider writing some code in C, 
using GRASS functions. Or you may prefer being patient... 

>    Can I do that using Perl or I have to use some other scripting
> language?  Where (web page) can I get some instruction?

First, you may want to have a look on some of the scripts included in GRASS5 
binaries. They should be in the 'scripts' directory in your current 
installation.
Then, if you're under unix/linux, you may want to consider going into bash 
scripting and learning gawk (as a first step before Perl...) :

http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/manual/gawk/html_chapter/gawk_toc.html

are some pretty good sites (actually, I don't know how I'd have done without  
'em).

Pierre

-- 
------------------------------
Soil and Water Laboratory
Biological and Environmental Engineering Department
Cornell University
Riley-Robb Hall
ITHACA, NY 14853 - USA



More information about the grass-user mailing list