[GRASS5] $LOCATION

Glynn Clements glynn.clements at virgin.net
Mon Nov 18 02:03:37 EST 2002


Regarding the recent change to lib/init/init.sh (in grass51):

----------------------------
revision 1.5
date: 2002/11/14 09:50:48;  author: alex;  state: Exp;  lines: +2 -1
Scripts in g51test-7 heavily use LOCATION variable - so I guess
it has to be exported. Besides, scripts 'tour' and 'tower'
also have to be modified in order to run them from any catalog -
change './tower' to '$LOCATION/../tower' and './mvascii' the same way.
I got demo tour working after that.
----------------------------

One of the features which is intended for 5.1 is to allow changing of
location/mapset within a session. This means that any scripts which
need to obtain the location/mapset must use g.gisenv. Anything which
uses environment variables won't work and needs to be fixed.

The recommended mechanism for Bourne shell scripts is to place the
following at the start of the script:

	: ${GISBASE?}
	eval `g.gisenv`
	: ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
	LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"

Actually, a number of existing scripts need to have the quotes added
to the last line. We need to allow for filenames which contain spaces;
these are likely to be common on Cygwin and MacOS X.

In particular, a number of Cygwin users have had problems because
$HOME contains spaces (e.g. "/cygdrive/c/Documents and Settings/<user>").
Similarly, anyone who installs GRASS in "Program Files" or who puts
the GRASS database in "Application Data" is likely to have major
problems.

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




More information about the grass-dev mailing list