[GRASS-user] GRASS Scripting questions
Glynn Clements
glynn at gclements.plus.com
Fri Dec 18 12:32:12 EST 2009
António Rocha wrote:
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Please don't post HTML-only mail to the list.
> Hey
> I have tried Glynn's solution like this:
> r.mapcalc "$GIS_OPT_COUNTER= float(0)"
> tmp=tmp.myscript.$$
>
> for opt in $GIS_OPT_INPUT; do
> r.mapcalc "$tmp = $opt + $GIS_OPT_COUNTER"
> g.rename rast=$tmp,$GIS_OPT_COUNTER
> done
> And I got
> syntax error, unexpected ',', expecting $end
Right; I forgot that you need:
IFS=,
as the map names in $GIS_OPT_INPUT will be separated by commas, not
spaces.
Without setting IFS, "$opt" will contain the list of input maps,
separated by commas, rather than individual maps.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list