[GRASS-user] scripting mapcalc

Glynn Clements glynn at gclements.plus.com
Thu Mar 5 23:41:08 EST 2009

Daniel Victoria wrote:

> To get around the ' or " problems when scripting for r.mapcalc I
> prefer to use another syntax construction that goes like this:
> echo "river = if(river == $old, $new, null())" | r.mapcalc
> That way you evaluate the variables $old and $new before sending it to
> r.mapcalc.

There is no advantage to using the above form. Even if you use:

	r.mapcalc "river = if(river == $old, $new, null())"

the variables are still expanded by the shell.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list