[GRASS-user] GRASS bash scripting - best practice questions

Daniel Victoria daniel.victoria at gmail.com
Mon Aug 23 19:51:47 EDT 2010


A couple of years ago I bough a used copy of "Learning the bash Shell"
(O'Reilly) [1]. It's a great book and can help you a lot with simple
and complex bash scripts.

As for automating grass operations, it depends on what sort of
processing you are doing. For instance, I do a lot of bash scripts to
import and process several maps in one pass. Something like this:

<pseudo-code here>
for map in map_list; do
r.in.gdal input=$map output=$map.imported
r.blablabla - process maps anyway you want
done

Cheers
daniel

[1] - http://oreilly.com/catalog/9781565923478

On Sat, Aug 21, 2010 at 3:45 PM, a. o. <ytrapaet at hotmail.com> wrote:
> I'm new to GRASS, but not GIS.  I am trying to clarify several uses of bash
> scripting in GRASS.
> I have GRASS installed at C:\Program Files\GRASS-64
> Q1) In my first test script I ran, I noticed that I could run test.sh with
> "sh test.sh"
> but this script ran when I put it in C:\Program Files\GRASS-64
> and also ran if I instead put it in C:\Program Files\GRASS-64\bin
> I'm wondering what is best practice of where to put your bash scripts and
> how to organize them?
> Q2) I'm going to be looking into running bash scripts that loop the same
> operation on many different files. I am wondering to start experimenting
> with this, do I first need to import all the files I want to work with into
> a particular GRASS database? or can GRASS do this kind of operation
> regardless of what database it is running? I guess I can reword this
> question as what would be the best practice to bash scripting a loop that
> iterates through many files.
> Q3) I'm also just learning bash scripting (for example I'm not yet sure how
> to run a .sh if it is in some other directory in bin without writing out the
> full path). On this note, I am wondering if there is a windows program that
> I can install where I can practice bash in the windows environment - without
> specifically running GRASS?
> Thanks for you help!
> ao
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>


More information about the grass-user mailing list