[GRASS-dev] Re: [GRASS-user] 6.4 vs 7.0

Paolo Craveri pcraveri at gmail.com
Mon Jan 18 15:04:38 EST 2010


2010/1/18 Glynn Clements <glynn at gclements.plus.com>:
>
> 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>
>

Yes, I forgot "export ..."; my fault.

Thanks

-- 
-- 
Paolo C.


More information about the grass-dev mailing list