[GRASS-user] simple shell scrip example with parameters

Daniel Victoria daniel.victoria at gmail.com
Wed Mar 23 18:28:23 EDT 2011

Not sure this is the best way to do but, if you are using bash in
linux, the variables $1 $2 and so on are the parameters you pass to
the script. So, if you have a script called basin.sh and you type

basin.sh -23 -47

the variable $1 will be -23 and $2 will be -47...

so in your script you could put

r.water.outlet drainadge=your_map basin=basin_map easting=$2 northing=$1

you could also pass a third parameter for the basin map name...

Here is a good online tutorial for bash scripting

Boa sorte

On Tue, Mar 22, 2011 at 5:25 PM, Marcello Benigno
<benigno.marcello at gmail.com> wrote:
> Hi All,
> I need build one script shell for GRASS that receive two parameters (x and y
> coordinates) and calculate the r.water.outlet to this point, but I'm newbie
> in shell programming. Anyone have a example or link to show something
> similar? In my tests I can run one simple script, without parameters, and
> now thats the point.
> Thanks in advance,
> --
> Marcello Benigno B. de Barros Filho
> Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
> Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE
> http://profmarcello.blogspot.com
> http://about.me/marcello.benigno
> _______________________________________________
> 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