[GRASS-user] Bash loop for mapcalc scripts

Moritz Lennert mlennert at club.worldonline.be
Tue Sep 17 07:50:26 PDT 2013


On 17/09/13 16:26, BLANDENIER Lucien wrote:
> Hello,
>
> I have some problem with the use of bash scripts for the r.mapcalc
> function. For bash loop operation, I use the fprint function in order
> allow GRASS to read each steps of the loop but this doesn't work with
> r.mapcalc.

Could you be more precise about what doesn't work ?

>
> Did someone alredy do some loops for the r.mapcalcs function with
> bash scripts in GRASS?

I've often used for loops with r.mapcalc operations, but never using 
printf.  Why not call r.mapcalc directly, i.e.

#!/bin/bash


for i in $(seq 1 1 100)
do
	
         r.mapcalc "new_rast = rast${i}@mapset*100"

done


?

Moritz


More information about the grass-user mailing list