[GRASS-user] replacement for d.mon in GRASS 7.0?

Glynn Clements glynn at gclements.plus.com
Wed Feb 2 04:56:11 EST 2011


Patrick_schirmer wrote:

> Does someone know how translate previous display commands into GRASS70, 
> i.e. integrate a py-script that is called
> "d.mon x1=start" (or similar) into GRASS70 doing these command:
> 
> #####start display in GRASS7.0
> export GRASS_PNGFILE=map.bmp
> d.erase
> ximgview map.bmp &
> export GRASS_PNG_MAPPED=TRUE

It can't be done that way. A program (or script) cannot change the
environment of its parent (e.g. the shell). This is why "export" has
to be a shell built-in rather than a program.

You could write a *shell* script which is "source"d rather than
executed, or you could write a script which sets the environment
variables then spawns a new shell.

But the only way that a "d.mon" program could be made to work would be
to change the drivers to read the settings from $GISRC rather than the
environment.

However, environment variables are more convenient for scripts and the
GUI. Checking for environment variables first then $GISRC second would
satisfy both use cases, but could be confusing for the user, as the
$GISRC settings would be ignored if one of the environment variables
was set.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list