[GRASS-dev] env variables not set

Glynn Clements glynn at gclements.plus.com
Mon Jan 7 06:52:13 EST 2008


Moritz Lennert wrote:

> I don't know if this is a local problem with my setup, but for some time 
> now, MAPSET, LOCATION_NAME, and GISDBASE are not defined anymore in a 
> running GRASS session. Just recompiled with fresh svn checkout, and the 
> problem persists.
> 
> This means that I can't do things like
> 
> database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
> 
> I don't see any relevant changes in lib/init/init.sh which could explain 
> this, but before I dig deeper to find out what's going on I would like 
> to hear whether anyone else has this problem.

This was changed years ago (in 5.x, AFAICT; there doesn't appear to be
any way to obtain the revision history for 5.x now that CVS is gone).

The reason is that these settings can change during the life of a
GRASS session (e.g. g.mapset), but there's no way that a module can
can change the environment of the session shell (this is why we have
$GISRC rather than using environment variables).

You need to get the values from g.gisenv, e.g.:

	GISDBASE=`g.gisenv GISDBASE`
	LOCATION_NAME=`g.gisenv LOCATION_NAME`
	MAPSET=`g.gisenv MAPSET`
	LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"

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


More information about the grass-dev mailing list