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.
Did someone alredy do some loops for the r.mapcalcs function with bash scripts in GRASS?
Thank for your help.
Lucien
(attachments)
example.sh (143 Bytes)
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
I tried with what you proposed. It work fine.
I just did an error with the ' quote.
Thanks
Lucien
________________________________________
De : Moritz Lennert [mlennert@club.worldonline.be]
Envoyé : mardi 17 septembre 2013 16:50
À : BLANDENIER Lucien
Cc : grass-user@lists.osgeo.org
Objet : Re: [GRASS-user] Bash loop for mapcalc scripts
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