[GRASSLIST:3266] Re: Wrestling with Grass5 env variables
Glynn Clements
glynn.clements at virgin.net
Thu Feb 28 18:28:17 EST 2002
William W. Hargrove wrote:
> I don't want to have to execute the grass5 script *at all*, I just want to have
> access to the grass commands and the rest of the linux commands available at any
> time. This used to work great under 4.1, but I can't seem to get it to go under
> 5.0.0.pre3.
>
> I have set these env variables in .bashrc:
AFAICT, the complete set of environment variables which are set by the
"grass5" script and etc/Init.sh is:
GISBASE
GISDBASE
GISRC
GIS_LOCK
GRASS_GNUPLOT
GRASS_GUI
GRASS_PAGER
GRASS_PERL
GRASS_TCLSH
GRASS_WISH
HOME
LD_LIBRARY_PATH
LOCATION
LOCATION_NAME
MAPSET
PAGER
PATH
TCLTKGRASSBASE
Notes:
1. HOME is set to $LOCATION while starting the shell, but set then set
back by the .bashrc file which is created by Init.sh.
2. AFAICT, GRASS_GUI is only used by the startup; the grass5 script
exports it for use by Init.sh, but it shouldn't be needed elsewhere.
3. Most of the GRASS_* variables are used by a few specific programs;
however, those programs generally assume that the variable has been
set, and don't provide any fall-back. However, GRASS_PAGER is used by
libgis, so it's important that this is set.
4. The core variables GISDBASE, LOCATION_NAME, and MAPSET are normally
read from $GISRC rather than from the environment. OTOH, GISBASE is
always read from the environment.
5. GIS_LOCK contains the PID of the session shell; AFAICT, it is only
used by v.digit, and by the display drivers if using FIFOs (the
default is to use sockets).
6. LD_LIBRARY_PATH should be irrelevant. The only libraries which
GRASS places in $GISBASE/lib are static libraries (libgis.a and
libdatetime.a). I suspect that this is in case the GDAL library (used
by r.in.gdal) is placed in $GISBASE/lib.
> Adding $GISBASE/lib to my LD_LIBRARY_PATH seems to have cured the problem.
Odd; possibly just coincidence.
> BTW, what problems am I likely to encounter in running grass5
> outside the grass5 shell?
There shouldn't be any, provided that all of the environment variables
are set correctly. Let us know if you encounter anything specific.
> I'm willing to take responsibility for cleaning up .tmp files.
>
> What about concurrency issues, since I will not have a .gislock5 file?
As well as writing to files within the current mapset, various
commands update the file specified by $GISRC. I suggest creating a new
file for each session, e.g.:
GISRC=$HOME/.grassrc5.$$
cp -f $HOME/.grassrc5 $GISRC
export $GISRC
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list