[GRASSLIST:482] Re: where is $LOCATION set

Glynn Clements glynn.clements at virgin.net
Tue Jun 24 02:10:44 EDT 2003


Erin ODoherty wrote:

> I am really out-of-date with GRASS.  I finally installed  GRASS 5.0.2 on a
> PC running Mandrake Linux and I am having trouble with the environment
> variables.  When I get into the first screen in GRASS I enter :
> Location: hayden
> Mapset: erin
> Database: /files/data
> 
> but if I type cd $LOCATION it puts me in /home/erin.  I tried putting a
> symbolic link there, but that didn't help.  Obviously I have something set
> wrong and I can't find where $LOCATION  is set to see if I can change it.
> (I installed as root, and then remembered that I was supposed to do it as a
> regular user.  I then tried the latter and it didn't work, so I went back
> to being superuser and reinstalled.  I guess it could be a problem with
> permissions.)

GRASS no longer reflects the $GISRC settings (database, location,
mapset) into the shell's environment. Consequently, "cd $LOCATION" is
effectively just "cd" (i.e. change to your home directory).

If you want these settings, you have to use g.gisenv, e.g.

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

If you find this useful, you can put it into the appropriate startup
file (e.g. ~/.grass.bashrc for bash).

The motivation for the change was to discover any scripts which were
erroneously obtaining this information from the environment instead of
from $GISRC.

At some point, it may be possible[1] to change these settings in the
middle of a GRASS session; in that situation, any environment
variables which were set at startup would no longer be correct.

[1] Actually, it's mostly possible now, but it's not officially
supported, and there are still some rough edges (e.g. "persistent"
programs such as tcltkgrass and NVIZ won't recognise the changes,
XDRIVER can get confused etc).

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list