[GRASS-dev] Re: [GRASS-user] 6.4 vs 7.0
Glynn Clements
glynn at gclements.plus.com
Sun Jan 17 21:16:49 EST 2010
Paolo Craveri wrote:
> > If you use "
> > GRASS_OVERWRITE=1 \
> > r.mapcalc "result = map * 4
> > it will work on both versions.
>
> In grass 6.4:
> GRASS_OVERWRITE=1
>
> r.mapcalc "result = rand(1,100)"
>
> 100%
>
> r.mapcalc "result = rand(1,200)"
> ##ok, raster result has been overwritten
> 100%
>
>
> In grass7.0:
> GRASS_OVERWRITE=1
>
> r.mapcalc "result = rand(1,100)"
>
> 100%
>
> r.mapcalc "result = rand(1,200)"
> ### raster 'result' hasn't been overwritten
>
> I have to setting GRASS_OVERWRITE variable and r.mapcalc command in
> the same line as you suggest:
> GRASS_OVERWRITE=1 r.mapcalc "r = rand(12,24)"
> in this case it works in both version. Strange behaviour IMHO.
This indicates a difference in the state of the shell between the two
cases, not a difference in GRASS.
Entering "GRASS_OVERWRITE=1" as a command sets the shell variable
GRASS_OVERWRITE. It doesn't necessarily cause it to be "exported" to
the environment used for child processes.
If the command "export GRASS_OVERWRITE" has been executed in the
current shell, the variable has been exported to the environment, and
any changes to the variable will affect the environment used for child
processes.
OTOH, the command "GRASS_OVERWRITE=1 r.mapcalc ..." executes r.mapcalc
with GRASS_OVERWRITE=1 in the environment for that specific process.
See the "bash" manual page for more information.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list